none
Executing comands in a MySql database RRS feed

  • Question

  • Hello everybody, After all sorry for my bad english, i speak spanish.
    I have a problem tring to execut a mysql command in Visual.net. I wanna load a row in my MySql Data base but i can't do it. Now I'm im tring to do that including the next module.
    Module general
       Public mCon As New MySql.Data.MySqlClient.MySqlConnection("Database=agenda_caipe;Data Source=adrian;User Id=root;Password=")
    End Module
    Then I try to execute a command in a form, when I click a button.
    Public Class Form3
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Try
                mCon.Open() 'Start Server conection
                form1.txt1.Text = "Conectado al servidor" & mCon.ServerVersion & ", en" & mCon.DataSource
               'HERE I THINK THAT I DON'T KNOW WHAT I MUST TO DO
      Dim myDataAdapter As New MySqlDataAdapter()

                Dim query As String = "INSERT INTO contactos(razon_social) VALUES ('valores de prueba')"
                myDataAdapter.SelectCommand = New MySqlCommand(query, mCon)


                Form2.Hide()
                ''''''''''''''''''''''''''''''''''''''''''''\
                mCon.Close() 'Finish server Conection
            Catch ex As Exception
                If (ex.Message = "") Then
                    Form2.Show()
                End If
            End Try
        End Sub
    Please is anybody wanna help me mailme at nicolas@caipe.com.
    Thanks everybody for readme...


    Nicolas Ardison
    nicolas.ard (at) ardsoluciones.com.ar
    http://www.ardsoluciones.com.ar

    Tuesday, September 18, 2007 7:55 PM