Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I got the error say : "Addition Information: No data exists for row/column" when I loaded data from OledBdatareader to textbox.

 

Here is my code

 

Function GetCustomer() as boolean

Dim dr as oledb.oledbDatareader

dim mycommand as new Oledb.OledbCommand()

dim myConn as new oledb.OledbConnection()

dim strSql as string

strSql = "Select SerialNumber, LastName, FirstName From Customer"

myconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Customer.mdb'"

myconn.open

mycommand = new oledb.oledbcommand(strsql, myconn)

try

dr = mycommand.executereader()

catch ex as oledb.oledbexception

return false

end try

while dr.read()

txtSerialNumber.text = dr("SerialNumber")

txtLast.text = dr("LastName")

txtFirst.text= dr("FirstName")

end while

dr.close

myconn.close

return true

End function

 

I debugged and It gave me the error at dr("LastName"). Please help me with this problem. Thanks

  • Moderators
Posted

Are you trying to bind the textboxes to the data?

In your code you are looping the DR, so what happens if there are 100 rows in it, will you display only the last row in your textbox?

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...