Saturday, March 31, 2012

System.IndexOutOfRangeException: There is no row at position 0

I'm getting a frustrating error that I can't seem to figure out with an update button. However, when I try to execute the Submit_Click sub I get the error that is the subject of this post. Can you see anything wrong with my code? The GetRecord sub work great on page_load to get the record in the first place, but in re-calling it it's not working.

Please help if you can, thanks!

Oh, E_ID refers to a context item (Dim E_ID as String = Context.Items("EmailID"))


Sub Submit_Click(Sender As Object, E As EventArgs)
GetRecord(E_ID)
Row = IndividualDS.Tables("Individual").Rows(0)
Row.Item("F_name") = FirstNameText.Text

Adapter.Update(IndividualDS, "Individual")
End Sub

Sub GetRecord(E_ID As String)
SelectStatement = "Select * From Individual Where Email='" & _
E_ID & "'"
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.mappath("policy_dir.mdb")

Connect.ConnectionString = ConnectString
Adapter.SelectCommand = _
New OleDbCommand(SelectStatement, Connect)
Adapter.SelectCommand.Connection.Open
IndividualCB = New OleDBCommandBuilder(Adapter)
Adapter.Fill(IndividualDS, "Individual")
Adapter.SelectCommand.Connection.Close
End Sub

You may find some helphere.
Thank you, that did help.

I am closer... I am now getting an error that says "operation must use an updateable query" what should I check for to correct this?
Check the search result in Google.
Thanks, I think i got it fixed

0 comments:

Post a Comment