none
Database Program Using Visual Basic 2005 and MySql

    Question


  • I want to Setup a simple sample database using MySql and Visual Basic 2005

    I want to have a MyDatabaseName and 3 tables: Client / Invoice and Invoice Items

    Client: Client Id /Name/Address/City/State
    Invoice: InvoiceId/Date/Invoice#/Client Id
    Invoice Item: ItemId/Quantity/Product Description/Price/

    I would like to make a form to : Add/Delete/Search/Print(send to textFile) to MySql:

    He is the starting Connection: (How can I go about doing this?)

    Imports MySql.Data.MySqlClient
    Imports MySql.Data.MySqlClient.MySqlDataAdapter
    Imports MySql.Data.MySqlClient.MySqlCommand
    Imports MySql.Data.MySqlClient.MySqlConnection
    Imports MySql.Data.MySqlClient.MySqlDataReader
    Imports MySql.Data.MySqlClient.MySqlTransaction

    Public Class Form2

    'Proyecto,add reference,mysql
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim connx As MySqlConnection
            connx = New MySqlConnection()
            connx.ConnectionString = "server=" & "localhost" & ";" _
            & "user id=" & "root" & ";" _
            & "password=" & "" & ";" _
            & "database=classicmodels"

            '& "user id=" & "root" & ";" _
            '        & "password=" & "MyDBPass" & ";" _
            ' & "database=myDBname"

            Try
                connx.Open()
                MessageBox.Show("Connection Opened Successfully, Esta conection abrio con exito ")

                connx.Close()
            Catch myerror As MySqlException
                MessageBox.Show("Error Connecting to Database: " & myerror.Message)
            Finally
                connx.Dispose()
            End Try
        End Sub
    End Class
    Tuesday, March 25, 2008 5:29 AM