PDA

View Full Version : اشکال در خواندن فیلد های دیتا ست پس از پرکردن ان با storedprocedure



roxf18
چهارشنبه 27 دی 1391, 21:25 عصر
با سلام من با یک storedprocedure یک دیتا ست را پر کردم حالا میخوام فیلد های سطر اخر را هرکدوم را تو یک textbox نشون بدم با کد زیر که جواب نداده غیر از ستون 0 هیچکدوم را نمیشناسه
int rows = ds.Tables[0].Rows.Count;
if (rows > 0)
{
txtmobile.Text = ds.Tables[0].Rows[rows-1][0].ToString();
txtaddress.Text = ds.Tables[0].Rows[rows - 1][1].ToString();
cmboxnoe.Text = ds.Tables[0].Rows[rows - 1][2].ToString();
txtname.Text = ds.Tables[0].Rows[rows - 1][3].ToString();
txtmotor.Text = ds.Tables[0].Rows[rows - 1][4].ToString();
txtshasi.Text = ds.Tables[0].Rows[rows - 1][5].ToString();
txtmodel.Text = ds.Tables[0].Rows[rows - 1][6].ToString();
txtplak.Text = ds.Tables[0].Rows[rows - 1][7].ToString();
txtcolor.Text = ds.Tables[0].Rows[rows - 1][8].ToString();