Error while Retreiving Data from Database

Posted by Saritha.rajeshkumar under C# on 5/16/2011 | Points: 10 | Views : 1326 | Status : [Member] | Replies : 3
hi,
iam getting the Error "There is no row at position 0"




Responses

Posted by: Lakn2 on: 5/17/2011 [Member] Starter | Points: 25

Up
0
Down
sqldataadapter da=new sqldataadapter("select * from tname",cn);
datatable dt=new datatable();
da.fill(dt);
if(dt.rows.count==0)
{
//some msg
}
else
{
// gridview1.datasource=dt;
//gridview1.databind();
or

textbox1.text=dt.rows[0][0].tostring();
....
}



Thanks&Regards
LakshmiNarayana Nalluri.

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lalji_mer on: 5/17/2011 [Member] Bronze | Points: 25
Posted by: Prabhakar on: 5/17/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Saritha.rajeshkumar


Show ur code and so we r try it . .

Best Regard's
Prabhakar

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response