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(cbPrSearc hList.SelectedI tem, ListItem)
Dim strSQLa As String = "SELECT sta_project_id_ fk " _
& " FROM tbl_staff_assig nments " _
& " WHERE sta_staff_id_fk = ?StaId "
cmSQL.Parameter s.Add("?StaId", objListItem1.ID )
cnSQL = New MySqlConnection
cnSQL.Connectio nString = connect.Connect ionString
cmSQL.Connectio n = cnSQL
cmSQL.CommandTe xt = 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_p k= ?PrId"
cmSQL.Parameter s.Add("?PrId", SaId)
cnSQL = New MySqlConnection
cnSQL.Connectio nString = connect.Connect ionString
cmSQL.Connectio n = cnSQL
cmSQL.CommandTe xt = strSQLb
Try
cnSQL.Open()
Try
drSQL = cmSQL.ExecuteRe ader()
' Always call Read before accessing data.
While drSQL.Read()
'Console.WriteL ine((myReader.G etInt32(0) & ", " & myReader.GetStr ing(1)))
lblPrID.Text() = drSQL.Item("pr_ project_id_pk") .ToString()
txtPrCode.Text( ) = drSQL.Item("pr_ project_code"). ToString()
txtPrLocation.T ext() = drSQL.Item("Pr_ Project_Locatio n").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.Messa ge, MsgBoxStyle.Cri tical, "General Error")
End Try
plz help me..
thnx..