Welcome to Dream.In.Code
Become a VB Expert!

Join 137,270 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,451 people online right now. Registration is fast and FREE... Join Now!




Can't Update boolean in access data base

 
Reply to this topicStart new topic

Can't Update boolean in access data base

Alchemyst
17 Nov, 2006 - 10:24 AM
Post #1

New D.I.C Head
*

Joined: 17 Nov, 2006
Posts: 2


My Contributions
The "Preview Data" shows that the code is connected to the Access data base(it displays the data correctly). The code runs fine with no errors reported. The MsgBox statement shows all data is correctly read from the data base, but the boolean is never updated to "True". No error is caught by the "Try" function. The tool tips seem to show that "tbl01" is an alias for the MarkBox data set. (By the way, that is "tbl" with a small "L" followed by "01".) I would appreciate any help in locating the problem.

CODE
Private Sub btnGoMark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoMark.Click
        Dim strX as String        
        Dim MarkBoxDataSet As New DataSet
        Dim tbl01 As New MarkBoxDataSet.ColorsDataTable
        ColorsTableAdapter.Fill(tbl01)  'get the data
        tbl01.PrimaryKey = New DataColumn() {tbl01.Columns(0)}
        Dim MyRow As DataRow
        Dim NewRow(3) As Object
        Try
            MyRow = tbl01.Rows.Find(intIndex)
            If MyRow Is Nothing Then
                MsgBox("Could not find row match.")
                Exit Sub
            Else
                NewRow(0) = MyRow.Item(0)
                NewRow(1) = MyRow.Item(1)
                NewRow(2) = MyRow.Item(2)
                NewRow(3) = True
                tbl01.BeginLoadData()
                tbl01.LoadDataRow(NewRow, True)
                tbl01.EndLoadData()
                Me.ColorsTableAdapter.Update(Me.MarkBoxDataSet.Colors)
            End If
            strX = CType(NewRow(0), String) & "," & NewRow(1) & "," & NewRow(2) & "," & CType(NewRow(3), Boolean)
            'MsgBox(strX)
            tbxDone.Text = "Done"
        Catch
            tbxDone.Text = "Not Done"
        End Try
    End Sub

User is offlineProfile CardPM
+Quote Post

Big T
RE: Can't Update Boolean In Access Data Base
17 Nov, 2006 - 07:43 PM
Post #2

New D.I.C Head
*

Joined: 13 Nov, 2006
Posts: 9


My Contributions
QUOTE(Alchemyst @ 17 Nov, 2006 - 11:24 AM) *

The "Preview Data" shows that the code is connected to the Access data base(it displays the data correctly). The code runs fine with no errors reported. The MsgBox statement shows all data is correctly read from the data base, but the boolean is never updated to "True". No error is caught by the "Try" function. The tool tips seem to show that "tbl01" is an alias for the MarkBox data set. (By the way, that is "tbl" with a small "L" followed by "01".) I would appreciate any help in locating the problem.

CODE
Private Sub btnGoMark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoMark.Click
        Dim strX as String        
        Dim MarkBoxDataSet As New DataSet
        Dim tbl01 As New MarkBoxDataSet.ColorsDataTable
        ColorsTableAdapter.Fill(tbl01)  'get the data
        tbl01.PrimaryKey = New DataColumn() {tbl01.Columns(0)}
        Dim MyRow As DataRow
        Dim NewRow(3) As Object
        Try
            MyRow = tbl01.Rows.Find(intIndex)
            If MyRow Is Nothing Then
                MsgBox("Could not find row match.")
                Exit Sub
            Else
                NewRow(0) = MyRow.Item(0)
                NewRow(1) = MyRow.Item(1)
                NewRow(2) = MyRow.Item(2)
                NewRow(3) = True
                tbl01.BeginLoadData()
                tbl01.LoadDataRow(NewRow, True)
                tbl01.EndLoadData()
                Me.ColorsTableAdapter.Update(Me.MarkBoxDataSet.Colors)
            End If
            strX = CType(NewRow(0), String) & "," & NewRow(1) & "," & NewRow(2) & "," & CType(NewRow(3), Boolean)
            'MsgBox(strX)
            tbxDone.Text = "Done"
        Catch
            tbxDone.Text = "Not Done"
        End Try
    End Sub



Have you tried:

CODE

          NewRow(3) = Yes


I'm not terribly familiar with the approch you're taking but for what it's worth, I am able to get a boolean field to update properly with an 'INSERT INTO' statement where the value is Yes.

hth

T


User is offlineProfile CardPM
+Quote Post

Alchemyst
RE: Can't Update Boolean In Access Data Base
21 Nov, 2006 - 01:53 PM
Post #3

New D.I.C Head
*

Joined: 17 Nov, 2006
Posts: 2


My Contributions
The problem appears to be that the memory copy of the data base table gets updated OK, but the data base on disk does not. The data base table in memory is "ColorsDataTable" and it can be updated. Do I need a connection between it and "System.data.dataTable"? If so, how?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 07:47PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month