Hi all,
I wonder how to add a bool value (true/false) to a datarow, I tried the following two ways, both don't work:
1.
bool selected = false;
DataRow dr = ds.Tables[0].NewRow();
dr[0] = selected;
ds.Tables[0].Rows.Add(dr);
2.
item = false;
ds.Tables[0].Rows.Add(Item);
What's the problem?
Thanks.
How to add a bool value to a datarow?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
tolikr3 pointsPosted Oct 21, 2005, 8:10 PM EDT
Hi,
You didn't specify the error message but it seems like the error caused by either ds or table.
Try to debug the application and see whether this line "dr[0] = selected;" has an error before you
add it to the Rows collection.