Insert to MySQL DB from Winforms app

R

Russ Green

Does anyone have any code samples of insert data into a MySQL db located
somewhere on the web from a winforms app?

TIA

Russ
 
N

NM

' Make sure first that you have the MySQL ODBC Driver installed :

Dim MyConnection As System.Data.Odbc.OdbcConnection

MyConnection = New System.Data.Odbc.OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};SERVER=server_name;DATABASE=base_name;USER=login;PASSWORD=pass")

Dim MyCommand As System.Data.Odbc.OdbcCommand = New Odbc.OdbcCommand("INSERT
INTO Tab1 (col1) VALUES (1)", MyConnection)

MyConnexion.Open()

MyCommand.ExecuteNonQuery()
 
R

Russ Green

Thanks,

Russ


NM said:
' Make sure first that you have the MySQL ODBC Driver installed :

Dim MyConnection As System.Data.Odbc.OdbcConnection

MyConnection = New System.Data.Odbc.OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};SERVER=server_name;DATABASE=base_name;USER=login;PASSWORD=pass")

Dim MyCommand As System.Data.Odbc.OdbcCommand = New Odbc.OdbcCommand("INSERT
INTO Tab1 (col1) VALUES (1)", MyConnection)

MyConnexion.Open()

MyCommand.ExecuteNonQuery()
 
T

Tom Shelton

Does anyone have any code samples of insert data into a MySQL db located
somewhere on the web from a winforms app?

TIA

Russ

You might want to check out the ByteFX MySQL data provider. It's free.
It works on both .NET and Mono (so, it is portable to Linux :), and it
seems to work pretty well for the little testing I've done with it so
far.

The nice thing about it is that it is 100% C# code, so there is not
need to install any of the MySQL client libraries...

http://sourceforge.net/projects/mysqlnet/

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top