Friday, March 30, 2012

Putting SqlDataSource code in code-behind

Hi,

I need some help here. I have a SELECT sql statement that will query the table. How do I get the return value from the sql statement to be assigned to a label. Any article talk about this?

Thanks geniuses.

This link:

http://aspnet.4guysfromrolla.com/articles/022206-1.aspx

|||

Hi ahTan,

You may need to use a SqlDataAdapter to fill the result set into a DataSet. Here is an example.

SqlConnection cnn = new SqlConnection("your connection string here");
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Table1", cnn);
DataSet ds = new DataSet();
sda.Fill(ds);

sql

No comments:

Post a Comment