how can i insert data into my sql database

hawad

New member
Joined
May 28, 2009
Messages
2
Programming Experience
Beginner
heloooo

a im try to conect my sql database withe vb.net2008 ( iam using MySQL Connector Net 6.0.3)

it is ok connection establashed by this code
VB.NET:
Imports MySql.Data.MySqlClient
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TestConnection()
    End Sub

    Public Sub TestConnection()
        Try
            Dim connStr As String = "Database=11;" & _
                    "Data Source=127.0.0.1;" & _
                    "User Id=root;Password="
            Dim connection As New MySqlConnection(connStr)
            connection.Open()



            MsgBox("Connection is okay.")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub
  
End Class



but i want insert data there and delete and update




i am try to do this by this code

VB.NET:
 Console.WriteLine("INSERT INTO Country (Code) VALUES ('00100000000000000')")
but it dosnt work , iam create table name called contry normaly with phpmyadmin (myaql adminisrition)

its ok creted


but i can insert data

can any one help me plz:)
 
Look into the MySqlCommand object.

You set the Connection and CommandText properties. Then invoke the Execute...() Function.
 

Latest posts

Back
Top