i want to retrieve data from Access table but i don't know where i am going wrong.here i am going to show my work which return errors:-
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Public Sub procedure1()
con.Provider = "Microsoft.jet.oledb.4.0"
con.Open(My.Application.Info.DirectoryPath & "\Database1.mdb")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim str As String = InputBox("enter first name to search")
Dim query As String = "Select * from ADODB where firstname="&str
procedure1()
rs.Open(query, con, 2, 3)
If rs.EOF = True Or rs.BOF = True Then
MsgBox("record not found")
Else
Me.TextBox1.Text = rs.Fields(1).ToString
Me.TextBox1.Text = rs.Fields(2).ToString
Me.TextBox1.Text = rs.Fields(3).ToString
End If
rs.Close()
con.Close()
rs = Nothing
con = Nothing
End Sub
error message showing that there is something wrong at line 17