Coverting data

R

Reggie

Hi and TIA. I have a datagride that has one field that is a true/false.
This data is returned from an sql db table and the data type is bit. The
data gride always displays true or false while the bit field is obviously 1
or 0 which is ok. My problem is that if/when I update other fields on that
record I get an error cause it doesn't convert the true/false back to a
bit(1-0). So how can I convert either the display in the grid to display
the actual value (1 or 0) or convert the true/false to a 1 or 0 before
executing the update? Thanks for your help. Below is a sample of what I'm
doing. Thanks for your time.

Dim txtApproved As TextBox
Dim bolApproved As Boolean
txtApproved = e.Item.Cells(5).Controls(0)
bolApproved = txtApproved.Text
cmdSelect.Parameters.Add("@approved", txtApproved.Text)
 
R

Reggie

I think I figured it out. Made these changes and it seems to work.
Dim txtApproved As TextBox
Dim bolApproved As Boolean
txtApproved = e.Item.Cells(5).Controls(0)
bolApproved = txtApproved.Text

cmdSelect.Parameters.Add("@approved", SqlDbType.Bit).Value = bolApproved
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top