Results 1 to 7 of 7

Thread: MySQL master / detail example or tutorial

Threaded View

  1. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Posts
    253

    Re: MySQL master / detail example or tutorial

    Thank you so much Sir!

    By the way, for the past months I am able to access the database by using codes like this

    Code:
    #Region "Check database connection"
        Public Sub Check_DB_Con()
            'Declare database credentials so we can refresh it in recheck timer
            server = My.Settings.DB_Server
            username = My.Settings.DB_Username
            password = My.Settings.DB_Password
            database = My.Settings.DB_Database
    
            'Connection String
            MysqlConn.ConnectionString = "server=" & server & ";" _
            & "user id=" & username & ";" _
            & "password=" & password & ";" _
            & "database=" & database & ";Allow User Variables=True"
        End Sub
    #End Region
    
    #Region "Update database connection"
        Public Sub Update_DB_Con()
            Check_DB_Con()
            Try
                MysqlConn.Open()
                frmMain.Database_Status = "Connected"
                MysqlConn.Close()
            Catch myerror As MySqlException
                frmMain.Database_Status = "Disconnected"
            Finally
                MysqlConn.Dispose()
            End Try
        End Sub
    #End Region
    
    #Region "Command for Increment"
        Sub Command_Increment(hardware_Add As String)
            Check_DB_Con() 'Check if the connection is okay
            MySQL_Query = "UPDATE service_info " _
                & "JOIN teller_info " _
                & "ON service_info.service_id = teller_info.service_id " _
                & "SET service_info.current_serving = (service_info.current_serving +1) " _
                & "WHERE teller_info.hardware_add = " & hardware_Add
            Dim MySQL_CMD As New MySqlCommand(MySQL_Query, MysqlConn)
    
            Try
                MySQL_CMD.Connection.Open()
                MySQL_CMD.CommandText = MySQL_Query
                MySQL_CMD.ExecuteNonQuery()
            Catch myerror As MySqlException
                Console.WriteLine(myerror)
            Finally
                MysqlConn.Close()
                MysqlConn.Dispose()
                populate_Service()
                Get_Teller_Num(hardware_Add)
                Update_Remaining_Queue(hardware_Add)
            End Try
        End Sub
    #End Region

    The way I'm calling it, isn't that ADO.NET because I am not using Datasets. I remember also that I am able to connect to database using the database connection wizard and that's where I remember the word provider and datasets. Is that what you called ADO.NET?
    Last edited by cary1234; Sep 21st, 2015 at 01:41 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width