TotalWhat
Members-
Posts
16 -
Joined
-
Last visited
TotalWhat's Achievements
Newbie (1/7)
0
Reputation
-
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
-
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?
-
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.
-
//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.