2 Replies - 4113 Views - Last Post: 21 November 2006 - 02:53 PM Rate Topic: -----

#1 Alchemyst  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-November 06

Can't Update boolean in access data base

Posted 17 November 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.

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



Is This A Good Question/Topic? 0
  • +

Replies To: Can't Update boolean in access data base

#2 Big T  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 9
  • Joined: 13-November 06

Re: Can't Update boolean in access data base

Posted 17 November 2006 - 08:43 PM

View PostAlchemyst, on 17 Nov, 2006 - 11:24 AM, said:

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.

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:

		  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
Was This Post Helpful? 0
  • +
  • -

#3 Alchemyst  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-November 06

Re: Can't Update boolean in access data base

Posted 21 November 2006 - 02:53 PM

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?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1