Try
conn.Open()
sql = "select * from fingerprint"
Dim cmd As MySqlCommand = New MySqlCommand(sql, conn)
Dim rdFinger As MySqlDataReader = cmd.ExecuteReader()
rdFinger.Read()
' เว้นไว้เพื่อใส่โค้ดมั้งครับ ^^
rdFinger.Close()
conn.Close()
conn.Dispose()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Private Function LoadDatabase()
UserRec = New ADODB.Recordset
UserRec.Open("Select * from tb_user", Conn, 1, 2)
FingerRec = New ADODB.Recordset
FingerRec.Open("Select * from tb_fingerprint", Conn, 1, 2)
'Load all fingerprint
UserFinRec = New ADODB.Recordset
UserFinRec.Open("Select * from tb_user u,tb_fingerprint f " & _
"where u.uID=f.f_uid", Conn, 1, 2)
Dim Template() As Byte
While Not UserFinRec.EOF
ReDim Template(UserFinRec("fTemplate").ActualSize)
Template = UserFinRec("fTemplate").Value
'Add finger from database to identify (1-N)
ScanerCtrl1.AddIdentifyDB(Template, UserFinRec("fID").Value & _
":" & UserFinRec("uName").Value)
UserFinRec.MoveNext()
End While
'Prepare memory for storage identify data (1-N)
ScanerCtrl1.LockIdentifyDB()
End Function