Saturday, February 25, 2012

Data access, DataReaders, DataSets, web pages and controls

I have a question about loading data on the page lode event. The question is more conceptual then how to.

Using C#, I would like to make a call to a SQL 2000 Server, with the use of a stored procedure return one row with eleven fields. Then use the data to fill five different controls. There is no manipulation of the data it is just presented as information. With a DataReader and the GetValues method using the resultant array I can fill the controls (or can I), or with a DataSet and the Load method do the same thing. Now this code can be placed in the code behind page or it can be implemented in a class. This is the only page that uses this combination of fields and controls; however I would think a more generic call to the data could be made then pick and chose the fields as needed. What process makes the most sense? Is what I just described even possible (as yet I haven't tried it)?

As always thanks in advance for any thoughts, comments, and suggestions.

hi Darel

i think u can create a function in a class and call that function in code behind. that function will return a dataset. u cannot use datareader as u have to fill more than one control in a function call.

No comments:

Post a Comment