Results 1 to 2 of 2

Thread: Altering the database through MySQL

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    1

    Unhappy Altering the database through MySQL

    So I have this code to connect to the MySQL database as other tutorials kept blocking access to the database, now here is the code I have, so what do I need to add so that when someone enters text into the textbox and clicks the button that connects them, adds the line to the database

    Code so far

    Code:
    Imports MySql.Data.MySqlClient
    Public Class Form1
        Dim CN As New MySqlConnection
        Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
            Dim ipAddress As String = "[REMOVED]"
            Dim myDatabase As String = "[REMOVED]"
    
            CN.ConnectionString = "Server = " & ipAddress & "; Database = " & myDatabase _
                & "; Uid = " & txtUser.Text & "; Pwd = " & txtPassword.Text
    
            Try
                If CN.State = ConnectionState.Closed Then
                    CN.Open()
                    btnLogin.Enabled = False
                    MsgBox("Connection established with the server!")
                    Logout.Enabled = True
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
    
    
    
            End Try
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Altering the database through MySQL

    Follow the CodeBank link in my signature and check out my thread on Retrieving & Saving Data for some examples of common ADO.NET scenarios.

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