Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

How do I connect to Mysql Database?

$
0
0
Instead of using the Microsoft access database. How to I convert this code into the proper way to connect to a MySQL Database with those rows?





'Enter Items in the items list if we are in the scan state. Basically we check against the database for the item.
'
'Connect to the Database
Dim dbConnect As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Database\Inventory.mdb")
'Dim rowIndex As Integer = 0

dbConnect.Open()

Dim dbAdapter As New OleDbDataAdapter("SELECT ItemNo, ItemName, BarCode, QTY, Price FROM Inventory", dbConnect)
Dim dbDataSet As New DataSet

dbAdapter.Fill(dbDataSet, "Inventory")

Dim dbTable As DataTable = dbDataSet.Tables("Inventory")


If CashPayment.Equals(False) And CreditCardPayment.Equals(False) Then
'Perform an udpate for any information entered into the text boxes
Update()
myDisplay.ClearText()

Dim myItem As String = txtItemInput.Text

For Each row As DataRow In dbTable.Rows

Dim ItemNo As String = row("ItemNo").ToString()
Dim ItemName As String = row("ItemName").ToString()
Dim BarCode As String = row("BarCode").ToString()
Dim QTY As Integer = row("QTY").ToString()
Dim Price As String = row("Price").ToString()

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>