Post data to a website (MySQL)?

swu

Active member
Joined
Mar 26, 2005
Messages
33
Programming Experience
1-3
I need to get data from a vb.net to a webpage, where I want to be able to manipulate the data and display it online.

My first thought is mysql. This process seems like a steep learning curve.

Does anyone have any good sample code for connecting vb.net to a mysql Db?

Thanks in advance.
 
If you have granted permission to access the mySQL remotely then it's pretty str8.

Add mySQL .NET connector (which is best btw) reference in the project and add the import statement like following:

VB.NET:
Imports MySql.Data.MySqlClient


then declare the connection object:

VB.NET:
Public strcon As String = String.Format("server={0};user id={1}; password={2}; database=databasename; pooling=false", "xxx.xx.x.xxxx", "username", "*******")
Public mysqlcon As New MySqlConnection(strcon)

then you just use that like usually ... say you want to open and close the connection against mySQL server remotely from your vb.net desktop solution.

VB.NET:
mysqlcon.Open()
Messagebox.Show(mysqlcon.State.ToString)
mysqlcon.Close()

Hope that helps :)
 
Back
Top