Click here to Skip to main content
14,739,804 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Sir,

I would like 2 tell you ,I have created array of 9 variables and in each var i have stored the value of 9 column from 2 table.Now i want if there is no data in any of the column ,then i want that my row will be displayed like this

c1 c2 c3 c4 c5 c6 c7 c8 c9

1 2 3 4 5 7 9
Rajesh Anuhya 21-Jun-13 2:20am
Not clear for me, Question is not matching with Subject line.
sanchit patne 21-Jun-13 2:25am
Please describe your question properly.
Rohit 2012 21-Jun-13 2:36am
actually i have 4 queries and 9 column and i have strored the value of 9 clomn into 9 var of string type .nw i want to display 9 clumn as a row wise ,then if there is no value in any of the clumn ,then it does not display whole row .and send me the error there is no row at position 3
Rohit 2012 21-Jun-13 2:28am
actually sir i m getting an error there is no row at postion 3 ,bt if i get answer from my question then I will be able to solve this error
Jameel VM 21-Jun-13 2:51am
Please post the code you have tried
OriginalGriff 21-Jun-13 3:02am
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
We need to see the code that generates the error.
Use the "Improve question" widget to edit your question and provide better information.
Rohit 2012 21-Jun-13 3:08am
if (ds.Tables[0].Rows.Count > -1)
s1 = ds.Tables[0].Rows[0]["c1"].ToString();
s2 = ds.Tables[0].Rows[0]["c2"].ToString();
s3 = ds.Tables[0].Rows[1]["c3"].ToString();
s4 = ds.Tables[0].Rows[1]["c4"].ToString();
s5 = ds.Tables[0].Rows[3]["c5"].ToString();
s6 = ds.Tables[0].Rows[3]["c6"].ToString();
s7 = ds.Tables[0].Rows[3]["c7"].ToString();
s8 = ds.Tables[0].Rows[2]["c8"].ToString();
s9 = ds.Tables[0].Rows[2]["c9"].ToString();
string[,] arrlist = {

//DataTable dt = new DataTable();
for (int i = 0; i < arrlist.GetLength(0); i++)
dt.Rows[i]["c1"] = arrlist[i, 0].ToString();
dt.Rows[i]["c2"] = arrlist[i, 1].ToString();
dt.Rows[i]["c3"] = arrlist[i, 2].ToString();
dt.Rows[i]["c4"] = arrlist[i, 3].ToString();
dt.Rows[i]["c5"] = arrlist[i, 4].ToString();
dt.Rows[i]["c6"] = arrlist[i, 5].ToString();
dt.Rows[i]["c7"] = arrlist[i, 6].ToString();
dt.Rows[i]["c8"] = arrlist[i, 7].ToString();
dt.Rows[i]["c9"] = arrlist[i, 8].ToString();

GridView1.DataSource = dt;
Button3.Enabled = true;
Button3.Visible = true;
Rohit 2012 21-Jun-13 5:28am
i have send you code plz reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900