Updating Boolean value

K

Katty

I'm trying to update a Table wich has Text and Boolean values. Text values
are updated without any problem, but changes on boolean value doesn't show
until restarting the application. It's an Access database, here's the code,
What am I missing here?

Function GetRow() As DataRow

Dim bm As BindingManagerBase
Dim drv As DataRowView
bm = BindingContext(Me.DataSet1, Table)
drv = CType(bm.Current, DataRowView)
GetRow = drv.Row

End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim drCurrent As DataRow
Dim cmdUpdate As System.Data.OleDb.OleDbCommand
Dim casa As Boolean

cmdUpdate = Me.DataAdapter.UpdateCommand
drCurrent = GetRow()

Me.daEmpresas.UpdateCommand.Parameters("Name").Value =
drCurrent.Item(0)
Me.daEmpresas.UpdateCommand.Parameters("Phone").Value =
drCurrent.Item(1)

'''''''''''''''Boolean Value is actually set to True, I'm trying to change
it to False and even doing it directly doesn't work

Me.daEmpresas.UpdateCommand.Parameters("Other").Value = False

Me.daEmpresas.UpdateCommand.Parameters("Date").Value = Now.Date
Me.daEmpresas.UpdateCommand.Parameters("Original_Name").Value =
drCurrent.Item(0, DataRowVersion.Original)

Me.OleDbConnection1.Open()
cmdUpdate.ExecuteNonQuery()
Me.OleDbConnection1.Close()

End Sub
 
E

Earl

Boolean comes in 3 Formats in Access: Yes/No, True/False, and On/Off. You
might want to experiment with each one in your design. You might also try
returning -1 and 0 instead of True/False.
 
K

Katty

How can I use Formats Yes/No and On/Off. I tried using this code and it
shows a sintax error:

Me.daEmpresas.UpdateCommand.Parameters("Other").Value = No

'or

Me.daEmpresas.UpdateCommand.Parameters("Other").Value = Off

And if I try it as string it returns an exception of course, it's not a
boolean value, had to try it anyway.
 
E

Earl

I don't see the issue if the parameters are correct and the database format
is correct. Maybe one of the 'Softies will leap in here.
 

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