I'm developing a very simple VB app in Visual Basic 2008, where i have a textbox being dynamically updated with a value every second, i need this value to be inserted into a mySQL DB, i have made the connection ok but not too sure how to structure the VB code around the SQL Query??
Here's my code so far...
Public Class MainForm
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = EthernetIPforSLCMicro1.ReadAny("F18:0")
End Sub
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New Odbc.OdbcConnection
Dim connString As String = "DRIVER={MySQL ODBC 5.1 Driver};" _
& "SERVER=localhost;" _
& "PORT=3306;" _
& "DATABASE=test;" _
& "UID=root;PWD=; OPTION =3;"
If conn.State = ConnectionState.Open Then conn.Close()
With conn
.ConnectionString = connString
.Open()
End With
End Sub
End Class
Any help, very much appreciated!!!