joe_pool_is
Member
When I try this:
Private Function DataWrite() as Boolean
AddHandler Adapter1.RowUpdated, AddressOf HandleRowUpdated
Try
Global.Command1 = New OleDbCommand
Global.Command1.CommandText = "SELECT @@IDENTITY"
Global.Command1.Connection = Connection1
Global.Command1.Connection.Open()
Adapter1.Update(DataTable1)
Global.Command1.ExecuteNonQuery()
Global.Command1.Connection.Close()
Return True
Catch ex As Exception
lblError.Visible = True
lblError.Text &= "Database Save Error.<br>" & _
"Error: " & ex.Message
Global.Command1.Connection.Close()
Return False
End Try
End Function
Private Sub HandleRowUpdated(ByVal sender As Object, ByVal e As OleDbRowUpdatedEventArgs)
If e.Status = UpdateStatus.Continue _
AndAlso e.StatementType = StatementType.Insert Then
' Get the Identity column value
e.Row("ID") = _
Int32.Parse(Global.Command1.ExecuteScalar().ToString)
txtClientID.Text = e.Row("ID").ToString
e.Row.AcceptChanges()
End If
End Sub
I get this Exception: "Unable to read ID number. Non-numeric data found."
When I look at my Access database, there is only one entry, and it is number 87 (the rest have been removed to help us debug).
Could anyone tell me why I am getting this error and please explain how to fix it?
Thanks,
Joe
Private Function DataWrite() as Boolean
AddHandler Adapter1.RowUpdated, AddressOf HandleRowUpdated
Try
Global.Command1 = New OleDbCommand
Global.Command1.CommandText = "SELECT @@IDENTITY"
Global.Command1.Connection = Connection1
Global.Command1.Connection.Open()
Adapter1.Update(DataTable1)
Global.Command1.ExecuteNonQuery()
Global.Command1.Connection.Close()
Return True
Catch ex As Exception
lblError.Visible = True
lblError.Text &= "Database Save Error.<br>" & _
"Error: " & ex.Message
Global.Command1.Connection.Close()
Return False
End Try
End Function
Private Sub HandleRowUpdated(ByVal sender As Object, ByVal e As OleDbRowUpdatedEventArgs)
If e.Status = UpdateStatus.Continue _
AndAlso e.StatementType = StatementType.Insert Then
' Get the Identity column value
e.Row("ID") = _
Int32.Parse(Global.Command1.ExecuteScalar().ToString)
txtClientID.Text = e.Row("ID").ToString
e.Row.AcceptChanges()
End If
End Sub
I get this Exception: "Unable to read ID number. Non-numeric data found."
When I look at my Access database, there is only one entry, and it is number 87 (the rest have been removed to help us debug).
Could anyone tell me why I am getting this error and please explain how to fix it?
Thanks,
Joe