Imports System.Data.OleDb
Imports System.Data
Dim myconnection As OleDbConnection = New OleDbConnection
myconnection.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=c:\AccessDatabase.mdb"
myconnection.Open()
Dim sqlstatement As String
Dim numrows As Integer
sqlstatement = "select count(*) from tool where itemnum= '" & itemnum.Text & "' "
Dim mycommand As OleDb.OleDbCommand
mycommand = New OleDbCommand(sqlstatement, myconnection)
'mycommand = New OleDb.OleDbCommand(sqlstatement, myconnection)
numrows = mycommand.ExecuteScalar()
If numrows > 0 Then
End If
myconnection.Close()
Dim sqlstatement As String
Dim numrows As Integer
sqlstatement = "select * from tool where itemnum= '" & itemnum.Text & "' "
Dim mycommand As OleDb.OleDbCommand
Dim reader As OleDbDataReader
mycommand = New OleDbCommand(sqlstatement, myconnection)
'mycommand = New OleDb.OleDbCommand(sqlstatement, myconnection)
reader = mycommand.ExecuteReader()
If reader.HasRows Then
While reader.Read()
Me.textbox.text = reader("unit")
.......
End While
End If
reader.Close()
myconnection.Close()