Here’s what you have to remember before or after you execute any command or query.Remember to always open the connection before you execute any query and close it after execution.Namespace is basically just a container for classes, interface, and all sorts of object oriented stuff that you can think of.Here’s a link if you want to learn more about namespaces. First you have to import it into your application, make sure that already installed the mysql connector on your computer before doing anything else.To set a form as the startup form you just have to open up the file from the solution explorer and under the Main() method just change the name of the Form supplied as the argument.In this case my default form is Form2 so just change it to whatever the name of the form you want to become the startup form.Do Work Try Dim conn As New Odbc Connection(str Conn String) start Dttm = Now() comm = New Odbc Command(sql Comm) comm. Select Command = comm ‘ Utilize the SELECT statement da.Fill(dt) ‘ Fill the Data Table Catch ex As Exception Msg Box(“ERROR: ” & ex. Critical, “Error running SQL”) db Close() End Try End Sub [/vbnet] [vbnet] Private Sub bg Worker Completed(By Val sender As Object, By Val e As Run Worker Completed Event Args) Handles bg Worker. Milliseconds & ” seconds”, True) Catch ex As Exception Message Box.
I’ll just discuss it briefly so that you will have an idea what it is.
The default user for mysql is root, and the default password is none but in here I have 1234 as my password.
For security sake don’t use these kinds of password on a live server. It’s a class whose methods are used for executing queries in a mysql database.
I’m going to paste the code for mysql connection on the form. It’s a temporary storage of data from the mysql database.
Next we specify the query to be used by the data adapter, the data adapter as defined by msdn serves as a bridge between a dataset and a data source for retrieving and saving data.
In the code below we used the My Sql Data Reader to read the rows returned from our select query.