Hello
I am new to using databases and I am struggling with this problem. I am using a VB program to automate a measurement process where I read via a com port some measurements and I want to place them in an access database. I wrote the the code to add a new row with all the data but when I go to look at it in another windows form where I view the database nothing is updated. Below is the code for the btn to create the new data row and update the database. Any help would be much appreciated.
Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' Create a new row.
Dim newRegionRow As ISDMeasurementDataset.Inside_LengthRow
newRegionRow = Me.IsdMeasurementDataset1.Inside_Length.NewInside_LengthRow
'newRegionRow.AutoNumber = ""
newRegionRow._Date = date1
newRegionRow.Time = time1
newRegionRow.Style = myShoeData.Style
newRegionRow.Model = myShoeData.Model
newRegionRow.Gender = myShoeData.Gender
newRegionRow.Size = myShoeData.Length
newRegionRow.Width = myShoeData.Width
newRegionRow.Last = myShoeData.Last
newRegionRow.Measurement = myShoeData.ISL(1)
newRegionRow._Operator = myShoeData.ISL(1)
Try
Me.IsdMeasurementDataset1.Inside_Length.Rows.Add(newRegionRow)
' Save the new row to the database
Me.Validate()
Me.MeasurementBindingSource.EndEdit()
Me.IsdMeasurementDataset1.AcceptChanges()
Me.Inside_LengthTableAdapter1.Update(Me.IsdMeasurementDataset1.Inside_Length)
' Application.DoEvents()
Catch ex As Exception
MsgBox("Database Update failed")
End Try
End Sub
I am new to using databases and I am struggling with this problem. I am using a VB program to automate a measurement process where I read via a com port some measurements and I want to place them in an access database. I wrote the the code to add a new row with all the data but when I go to look at it in another windows form where I view the database nothing is updated. Below is the code for the btn to create the new data row and update the database. Any help would be much appreciated.
Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' Create a new row.
Dim newRegionRow As ISDMeasurementDataset.Inside_LengthRow
newRegionRow = Me.IsdMeasurementDataset1.Inside_Length.NewInside_LengthRow
'newRegionRow.AutoNumber = ""
newRegionRow._Date = date1
newRegionRow.Time = time1
newRegionRow.Style = myShoeData.Style
newRegionRow.Model = myShoeData.Model
newRegionRow.Gender = myShoeData.Gender
newRegionRow.Size = myShoeData.Length
newRegionRow.Width = myShoeData.Width
newRegionRow.Last = myShoeData.Last
newRegionRow.Measurement = myShoeData.ISL(1)
newRegionRow._Operator = myShoeData.ISL(1)
Try
Me.IsdMeasurementDataset1.Inside_Length.Rows.Add(newRegionRow)
' Save the new row to the database
Me.Validate()
Me.MeasurementBindingSource.EndEdit()
Me.IsdMeasurementDataset1.AcceptChanges()
Me.Inside_LengthTableAdapter1.Update(Me.IsdMeasurementDataset1.Inside_Length)
' Application.DoEvents()
Catch ex As Exception
MsgBox("Database Update failed")
End Try
End Sub