have you declared the datareader properly??? like
- Dim dr As OleDbDataReader
otherwise post the relevant portion of your code..........
thnx....
search button_click
Dim cmSQL As New MySqlCommand
Dim cnSQL As MySqlConnection
Dim objListItem1 As ListItem
' Get Primary Key from Listbox
objListItem1 = CType(cbPrSearchList.SelectedItem, ListItem)
Dim strSQLa As String = "SELECT sta_project_id_fk " _
& " FROM tbl_staff_assignments " _
& " WHERE sta_staff_id_fk = ?StaId "
cmSQL.Parameters.Add("?StaId", objListItem1.ID)
cnSQL = New MySqlConnection
cnSQL.ConnectionString = connect.ConnectionString
cmSQL.Connection = cnSQL
cmSQL.CommandText = strSQLa
Dim drSQL As MySqlDataReader
Dim strID As String
Dim SaId As String
SaId = drSQL.Item("pr_project_id_fk").ToString()
Dim strSQLb As String = "SELECT * from tbl_projects where pr_project_id_pk= ?PrId"
cmSQL.Parameters.Add("?PrId", SaId)
cnSQL = New MySqlConnection
cnSQL.ConnectionString = connect.ConnectionString
cmSQL.Connection = cnSQL
cmSQL.CommandText = strSQLb
Try
cnSQL.Open()
Try
drSQL = cmSQL.ExecuteReader()
' Always call Read before accessing data.
While drSQL.Read()
'Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1)))
lblPrID.Text() = drSQL.Item("pr_project_id_pk").ToString()
txtPrCode.Text() = drSQL.Item("pr_project_code").ToString()
txtPrLocation.Text() = drSQL.Item("Pr_Project_Location").ToString()
filing into every textbox...
.......................
drSQL.Close()
' Close the connection when done with it.
cnSQL.Close()
cmSQL.Dispose()
cnSQL.Dispose()
Catch myerror As MySqlException
MsgBox("There was an error reading from the database: " & myerror.Message)
End Try
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try
plz help me..
thnx..