Skip to content

How to add a bool value to a datarow?

halifaxdal

Asked Oct 21, 2005, 8:04 PM EDT1 answer
Share
LinkedInX
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.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    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.

    0