|
-
Mar 29th, 2008, 09:08 AM
#1
Thread Starter
Hyperactive Member
Reader get one row at a time
I have bit coneputal problem .
The SqlDataReader can only retrieve one row at a time from the data source and in order for it to get the next record, it has to maintain its connection to the data source..
string sSQL = "SELECT * FROM Products";
string sConnString =
"Server=(local);Database=Northwind;Integrated Security=SSPI;";
using (SqlConnection oCn = new SqlConnection(sConnString))
{
SqlCommand oSelCmd = new SqlCommand(sSQL, oCn);
oSelCmd.CommandType = CommandType.Text;
oCn.Open();
SqlDataReader oDr = oSelCmd.ExecuteReader();
DataGrid1.DataSource = oDr;
DataGrid1.DataBind();
}
if it get one row at a time then how it binds the data to grid if it contain one record at a time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|