Connect to an SQL server hosted on a remote machine with a Public STATIC IP, and also modify and add stuff there -


i'm beginner @ vb.net , wanted try out stuff on vb.net acquainted it., hope don't mind.

so, connect database hosted on vps, tried out

dim connetionstring string     dim cnn sqlconnection     connetionstring = "data source=censored;initial catalog=censored;user id=mydbuser;password=mydbpass"     cnn = new sqlconnection(connetionstring)     try         cnn.open()         msgbox("opened. queries can performed now.")         cnn.close()     catch ex exception         msgbox("cannot open, please check information.")     end try 

it gave me error saying cannot open caught exception.

i wanted know how can edit , add values in tables in sql server make connection to.

thanks in advance, best regards..

b-me

you need install .net driver mysql https://dev.mysql.com/downloads/connector/net

then should able use described here: https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-connection.html

right click on project , make sure there reference mysql connector, if not add it.

put @ top:

imports system.data     imports mysql.data imports mysql.data.mysqlclient 

then try like:

 dim connectionstring string  dim cnn mysqlconnection  connectionstring = "server=censored;user=mydbuser;database=censored;port=3306;password=mydbpass;"  cnn = new mysqlconnection(connectionstring)  try      cnn.open()      msgbox("opened. queries can performed now.")      cnn.close()   catch ex exception      msgbox(ex.message)   end try 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -