error ----Cannot implicitly convert type sring to string[]...
Hi,
I am getting above error .
my code is...
string [] fksprd_id;
cmd = new sqlcommand("select id from table1 where name = ' "+txt.text+" ' ",con);
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
cmd.Dispose();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
fksprd_id =ds.Tables[0].Rows[i][0].ToString();
}
i just want to store id in this array but iot shows error like
Cannot implicitly convert type sring to string[]...
..
Thanks in advance..
Cannot implicitly convert type sring to string[]...
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Suthish NairRank #92 · 22.8K reputationPosted Aug 22, 2010, 1:02 AM EDT
StringCollection fksprd_id = new StringCollection(); DataTable dt = new DataTable(); dt.Columns.Add("Name"); dt.Rows.Add("Hello"); dt.Rows.Add("Testing"); for (int i = 0; i < dt.Rows.Count; i++) { fksprd_id.Insert(i,dt.Rows[i][0].ToString()); //or, fksprd_id.add(dt.Rows[i][0].ToString()); }Sam HobbsRank #108 · 20.5K reputationPosted Aug 22, 2010, 6:19 AM EDT
to: