Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlDataSource.Select()? How do I use this? (ASP.net)

I'm trying to retrieve values using VB.NET from a SQL database. How do I use SqlDataSource.Select()? Is there a way to move the value to a variable that I can use for other things?

I know its kind of scattered and vague but that is the best I can do. I basically need to set a labels text to a value in a table.

like image 295
Freesnöw Avatar asked Apr 01 '11 16:04

Freesnöw


1 Answers

This puts the result query in to a DataTable.

DataView view = (DataView)dataSource.Select(new DataSourceSelectArguments());
DataTable groupsTable = view.ToTable();
String value;

foreach (DataRow dr in dt.Rows)
{
    // Do something here IE grab the value of the first column
    value = dr[0];
}
like image 131
Hna Avatar answered Nov 11 '22 19:11

Hna