Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I selected an Item from dwopdownlist
I want to transfer its related data in to textboxes
I used the following code
How can I get the second field's data from the data record

What I have tried:

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim strConnString As String
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("carrent.mdb") & ";Jet OLEDB:Database Password=;"
objConn = New OleDbConnection(strConnString)

Dim strSQL = "select * from ListOfCars where car_id=" & CInt(DropDownList1.SelectedValue) & " "

objConn.Open()

objCmd = New OleDbCommand(strSQL, objConn)
Dim myreader = objCmd.ExecuteReader()

Response.Write(DropDownList1.SelectedValue)
Response.Write(myreader.GetString(1)) 'here I get the error

End Sub
Posted
Updated 13-Oct-22 22:40pm

1 solution

This is the same question as A problem when transferring data from commandobj[^]; please do not repost. If you have information to add then edit the original question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900