i connect database with vb.net and also i receive a single value from my receiver through serial port. now i want to match this single data with one field of database. how can i do it. plz help me. i have attached my code.

Public Class Form1

Private Sub OPEN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text Is "Open Port" Then
Button1.Text = "Close Port"
Button1.Enabled = True

ElseIf Button1.Text Is "Close Port" Then
Button1.Text = "Open Port"
Button1.Enabled = False
End If

End Sub

Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ListBox1.Items.Add("Received: " + SerialPort1.ReadLine())
Dim var1 = ListBox1.Text

End Sub

Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click

Dim con As New OleDb.OleDbConnection

Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim dg As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:\Documents and Settings\Faizan Naseem\Desktop\AddressBook\AddressBook.mdb"

con.ConnectionString = dbProvider & dbSource


sql = "SELECT * FROM tblContacts"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")

MsgBox("Database is now open")


MsgBox("Database is now Closed")

End Sub

Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged

End Sub
End Class


Edited 6 Years Ago by silaj: n/a

This article has been dead for over six months. Start a new discussion instead.