TotalWhat
-
Posts
16 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by TotalWhat
-
-
It does not need to return the value. It needs to return 'True' if the value is less than 45 and 'False' if the value is more than 45. That query I wrote will say if the value is lower or higher then 45. Now I need a function that uses that value to decided to return 'True' or 'False'.
-
Hey!
I need a function that returns 'True' if the following query returns a value that is less than 45.
select sum(assignmentPoints) as Points from Assignment a join Studies son a.courseCode = s.courseCode and a.assignmentName = s.assignmentName and a.sectionName = s.sectionName and pnr = '851326'where assignmentPoints > 45
I also want the query to return 'False' if that value that query returns is more than 45, if that query returns 'null' in other words.
Could anyone help me out?
-
MSSQL
-
This is as far as I have come:
create trigger CourseEnrollmentTriggeron Studiesinstead of insertasbeginselect sum(assignmentPoints) as Points from Assignment a join Studies son a.courseCode = s.courseCode and a.assignmentName = s.assignmentName and a.sectionName = s.sectionName and pnr = '851326'if < 45end go
-
Hey!
So I have a database that handles students, courses and registration.
I have a table called Assignments which has three values "courseCode", "assignmentName" and "points".
I have a table called Students that has the value "pnr".
I have a table called Courses that has the value "courseCode".
I have a table called Studies that has the values "courseCode", "pnr" and "assignmentName".
I have a table called HasStudied that has the values "courseCode, "pnr, "assignmentName" and "grade".
Now I need a check, constraint or trigger of some type that will prevent the administrator from being able to register a student to too many courses. A student can read 45points of courses as maximum.
How would I go about this?
Thank you!
-
Hey! I have a webservice that returns a List<List<string>>. But when it passes through the SOAP document it comes out as string[][] for some reason. Anyway I need to convert this string[][] to a DataTable so I can use it in a DataGridView. Thank you for your help!
-
I've gotten this far:
public List<List<string>> Convert(DataTable dataTable) { var result = List<List<string>>; // Loop over all the rows foreach (var row in DataTable.Rows) { var newRow = List<string>; // Loop over all the cells foreach (var cell in row.Cells) { newRow.Add(cell.ToString()); } result.Add(newRow); } return result; }
But it doesent work and I'm not sure how to finish it.
Not even sure if it would be able to do what I want it to do. That is to convert a datatable to a list..
-
Hello everyone!
So I have a webservice that I made in C# that use DataTable, this works fine in my .net application which can consume DataTable. But I can't use it in my java application.
So I need a way to convert the DataTable to a List when the java application use the webservice.
Could anyone help me out?
-
Hello!
I want to send a DataTable type from my DAL via my Webservice to the user application. It doesen't seem to work to send a DataTable via the SOAP document though. Is there a work around? I'm very new to Webservice.
-
Any ideas?
-
//GUI
private void TestButton_Click(object sender, EventArgs e) { dataGridView1.DataSource = controller.TestMethod(); }
//Controller
public DataTable TestMethod() { ERPService.LU_ERPWebServiceSoapClient client = new ERPService.LU_ERPWebServiceSoapClient(); DataTable dataTable = client.TestMethod(); return dataTable; }
//Webservice
[WebMethod] public DataTable TestMethod() { DAL dal = new DAL(); DataTable dataTable = dal.TestMethod(); return dataTable; }
//DAL
public DataTable TestMethod() { command.Connection = OpenConnection(); try { command.CommandText = "select * from CRONUSSverigeAB$Employee"; SqlDataAdapter dataAdapter = new SqlDataAdapter(command); dataAdapter.Fill(dataTable); return dataTable; } catch (SqlException) { throw new DatabaseException("An error has occured. Please contact support."); } finally { command.Connection.Close(); } }
Maybe this will make it more understandable!
-
Hey all!
Not sure if I put this one in the right subforum but here it goes.
So I have a Form application that has a button that shows the content of a SQL database.
So I have the sql code "select * from blabla" in my DAL. I then made a Webservice with a Webmethod for that method in the DAL. I then used "Add reference" in my Forms application to accsess the method in the DAL via the Webservice. The problem is that my method that contains the sql code returns a DataTable of the content in the database. And I guess the xml code in the webservice can't handle that format cause it crashes. Something about it being unable to generate the xml code.
So If I want to return the content of a table in my MSSQL database and then present it in a datagridview in a forms application, what do I need to do? I have to use a WebService in between, thats just how the assignement looks like.
Thank you for your reply, I do understand that the text might be somewhat hard to understand.
-
SQL Question
in SQL
I managed to solve the question with the help of the suggested self-join.
select t1.FrogName, t2.FrogName
from Frog t1, Frog t2
where t1.FrogName != t2.FrogName and t1.FrogHabitat = t2.FrogHabitat;
-
SQL Question
in SQL
You can ORDER BY habitat. Frogs of the same habitat will be grouped together.
When looping through the results in PHP you can check when the habitat name changes in order to put separations between them.
I don't use PHP, just mssql. I didn't really understand. I have tried to use order by to achieve my results but failed so far. Could you please explain in more detail. Thank you!
-
SQL Question
in SQL
This question has been solved. The solution is at the bottom.
Hi! So here's the question for you.
I use Microsoft SQL Server Management Studio.
I have a table 'Frogs', that has two attributes. FrogName and FrogHabitat.
If I do a select * from the table the output is something like this:
FrogName FrogHabitat
Wood frog Iceland
Wood frog Denmark
Wood frog Sweden
Sky frog Iceland
Sky frog Germany
Hill frog France
Hill frog Sweden
The question is: "Write the query that would produce the FrogName of pairs of Frogs whom both share the same FrogHabitat".
And the final output should look like this:
FrogName FrogName
Sky frog Wood frog
Wood frog Sky frog
Hill frog Wood frog
Wood frog Hill frog
I have thought about this allot but I can't figure out what the right query would be. Any help along the way to enligthment would be much appreciated!
Thank you!
MSSQL Query Question
in SQL
Posted
This was solved at another forum, but I'll post the solution here as well.
CREATE FUNCTION fn_FunctionName(-- Add the parameters for the function here@PNR VARCHAR(50))RETURNS BITASBEGIN-- Declare the return variable hereDECLARE @Result BIT =0 select @Result = CASE WHEN sum(assignmentPoints) > 45 THEN 1ELSE 0END as Points from Assignment a join Studies s on a.courseCode = s.courseCode and a.assignmentName = s.assignmentName and a.sectionName = s.sectionName and pnr = @PNR-- Return the result of the functionRETURN @ResultENDGO