Re: mySQL and VB.net for newbie
Posted by: Brennon Williams
Date: November 14, 2004 03:56PM

Just to get you started....

Public Function TestConn() As Boolean

Try

'connection string to MySql Database which in this case is running on a remote machine
Dim DB_CONN_STR As String = "Database=DB_MASTER;Data Source=192.168.0.4;User Id=Test;Password=Tester"

'Build your query string
Dim SQLstr As String
SQLstr = "SELECT * FROM MY_TABLE"

'Define the connection, command and datareader objects (you could use a dataset)
Dim Master_CON As New MySqlConnection(DB_CONN_STR)
Dim Master_COM As New MySqlCommand(SQLstr)
Dim BULK_PACKET As MySqlDataReader

'Assign the connection
Master_COM.Connection = Master_CON

'Do the good stuff
Master_CON.Open()

'Excute the connection call that returns a reader object
BULK_PACKET = Master_COM.ExecuteReader()

'Loopthrough the returned records
Do While BULK_PACKET.Read
MsgBox(BULK_PACKET.Item("Field_1").ToString)
Loop

'Job done
Master_COM.Connection.Close()
Return True
Catch ex As Exception
MsgBox("Error ---> : " & ex.Message)
Return False
End Try
End Function

Options: ReplyQuote


Subject
Written By
Posted
November 12, 2004 05:42PM
Re: mySQL and VB.net for newbie
November 14, 2004 03:56PM
November 14, 2004 08:04PM
November 14, 2004 08:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.