how to return and display results in an ASP.NET table?
Posted on 2004-10-27
I have a completed asp.net table, what I intend to do is after calling a stored procedure in SQL Server, I need to return and display the several columns of one record to the table (by replacing the labels of each cell with new data from the database). The table format is like:
<asp:table id="Table1" ...
<asp:Label ID="LabelTest1", Text="..."...
What i want to do is like this: Table1.LabelTest1.Text = "returned value";
Of course, it's not allowed in ASP.NET.
In my design, the return values are five output parameters from a stored procedure. So basically, just one input parameter (user ID) and returned related information of that user(five output parameters of the stored procedure). Also, i need to insert related data to another table in the stored procedure.
My question is: Is there a better ASP.NET database scenario for this? How to display returned results in an existing table? Is it good to use five output parameters of the stored procedure? Is there any other better designs? Also, since the stored procedure i wrote involves two actions:
1. validation the user ID and retrieving the user information by using output parameters;
2. inserting the time, and other activity information to a new table.
Shall I use ExecuteNonQuery or ExecuteReader? Thanks a lot for any suggestion.