07-21-2012, 12:23 PM
First, you want to add a reference to MySQL.Data to your project. Then, you want to:
[code2=vbnet]Imports MysQL.Data.MySqlClient[/code2]
Then, this is the code you're going to want to use to get the densities and boiling points from the MySQL database, or something like this:
[code2=vbnet]Dim conn As MySqlConnection = New MySqlConnection("MYSQL CONNECTION STRING")
Dim sqlQuery As String = "SELECT * FROM Chemicals WHERE Name='" & itemName & "'"
Dim command As New MySqlCommand
command.Connection = conn
command.CommandText = sqlQuery
Dim adapter As New MySqlDataAdapter
adapter.SelectCommand = command
Dim data As MySqlDataReader
conn.Open()
data = command.ExecuteReader
While data.Read
boilingPoint = CDbl(data(1))
density = CDbl(data(2))
End While
data.Close()
conn.Close()[/code2]
[code2=vbnet]Imports MysQL.Data.MySqlClient[/code2]
Then, this is the code you're going to want to use to get the densities and boiling points from the MySQL database, or something like this:
[code2=vbnet]Dim conn As MySqlConnection = New MySqlConnection("MYSQL CONNECTION STRING")
Dim sqlQuery As String = "SELECT * FROM Chemicals WHERE Name='" & itemName & "'"
Dim command As New MySqlCommand
command.Connection = conn
command.CommandText = sqlQuery
Dim adapter As New MySqlDataAdapter
adapter.SelectCommand = command
Dim data As MySqlDataReader
conn.Open()
data = command.ExecuteReader
While data.Read
boilingPoint = CDbl(data(1))
density = CDbl(data(2))
End While
data.Close()
conn.Close()[/code2]