September 24th, 2003, 04:09 PM
Sql With VB.net problem
Hi all im a newbie to programming and i've ran into a problem
i can't get my program to connect to a remote sql server
but it does connect to my local one with "localhost" as the server, it does not work with my ip either and its gettin to me
anyway heres the code
fsConn = "Data Source=mysql;" & _
"Data Source=xx.xx.xxx.xxx;" & _
"Database=test;" & _
"User ID=monkey;" & _
"Password=XXXXXXXX;" & _
cn = New MySqlConnection(fsConn)
im using the eInfoDesigns DLL
cheers for any replys
September 25th, 2003, 09:38 AM
I cant give you a total solution, but I can give you some options to look at:
Dim oMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString = "Data Source=localhost;" & _
"Database=mySQLDatabase;" & _
"User ID=myUsername;" & _
"Password=myPassword;" & _
For more information, see: http://www.einfodesigns.com/dbProvider_info.aspx
Im fairly certain you can just replace 'localhost' with your ip address. Another example i've got is:
ODBC .NET Data Provider connection string, connecting to the USERMANPC MySQL Server with IP Address 10.8.1.30:
If the names service is set up OK you should also be able to use:
I wont vouch for the accuracy or correctness, though its another thing to look at.
Last edited by Pain; September 25th, 2003 at 09:40 AM.
September 25th, 2003, 09:51 AM
cheers for your reply i will give them a go
September 25th, 2003, 06:04 PM
right i gave every combi a chance and no look, is there any example programs to do this ?
September 26th, 2003, 05:29 AM
At present, mySQL is not supported by vs.NET and as a result, any connections you make have to be 'hard coded' into your script.
The standard 'add connection' and then drag-n-drop oledbconnection onto your form will result in messages like "not allowed" or "this version of vs.net doesnt do this" or "haha you think Bill Gates want it that easy for you to use non microsoft products? Get a life you lepper!"
If it helps any, i've got the same problem.
Just make sure, that you've got mysql correctly set up on the host machine (using mysql server), and that the database itself is fully setup within the ODBC Connections (control panel area) under the file/system dsn (cant remember off the top of my head which one you need, but one is local to the machine, the other is to the network), and ensure you have similarly set up the same odbc connection on the client machines to look to the IP address of the host server. Both the client and server machines will need the mySQL drivers (downloadable from mysql.com if needed) and then start praying for miracles.
The code that I gave you should (in theory) work, but then, Microsoft have this habit of not making anything non-MS work too easily.
September 27th, 2003, 03:34 PM
Right i have sorted it
i downloaded this dll
Dim fsConn As String
Dim cn As MySqlConnection
Dim cmd As New MySqlCommand()
fsConn = "Data Source=test;" & _
"Server=xx.xx.xxx.xxx;" & _
"Database=test;" & _
"User ID=myid;" & _
"Password=mypassword;" & _
cn = New MySQLConnection(fsConn)
it appears to be working gr8