joe_pool_is Posted November 18, 2004 Posted November 18, 2004 (edited) When I try this: [edit]Please use code tags when posting code, Joe.[/edit] 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 The problem is that e.Row("ID") is not returning anything. 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 Edited November 19, 2004 by Derek Stone Quote Avoid Sears Home Improvement
joe_pool_is Posted November 18, 2004 Author Posted November 18, 2004 In fact, I have placed a breakpoint on my "HandleRowUpdated" sub, but it never stops there. How can I make sure that this event is even happening? It used to work, so I don't know why it would have stopped. Quote Avoid Sears Home Improvement
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.