#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0

    Arrow 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;" & _
    "Command Logging=false"
    cn = New MySqlConnection(fsConn)
    cn.open()

    im using the eInfoDesigns DLL

    cheers for any replys

    monkey
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Sheffield, UK
    Posts
    94
    Rep Power
    11
    Hiya,

    I cant give you a total solution, but I can give you some options to look at:

    http://www.able-consulting.com/dotne...NativeProvider

    Imports EID.MySqlClient

    Dim oMySqlConn As MySqlConnection = New MySqlConnection()
    oMySqlConn.ConnectionString = "Data Source=localhost;" & _
    "Database=mySQLDatabase;" & _
    "User ID=myUsername;" & _
    "Password=myPassword;" & _
    "Command Logging=false"
    oMySqlConn.Open()


    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:





    “DRIVER={MySQL};SERVER=10.8.1.30;UID=UserMan;PWD=userman;DATABASE=UserMan”



    or



    “DRIVER={MySQL};SERVER=10.8.1.30;UID=UserMan;PWD=userman;Initial Catalog=UserMan”



    If the names service is set up OK you should also be able to use:



    “DRIVER={MySQL};SERVER=USERMANPC;UID=UserMan;PWD=userman;DATABASE=UserMan”



    I wont vouch for the accuracy or correctness, though its another thing to look at.

    Chris
    Last edited by Pain; September 25th, 2003 at 08:40 AM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0
    cheers for your reply i will give them a go
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0
    right i gave every combi a chance and no look, is there any example programs to do this ?

    cheers monks
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Sheffield, UK
    Posts
    94
    Rep Power
    11
    Unfortunately not.

    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.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    4
    Rep Power
    0
    Right i have sorted it

    i downloaded this dll

    http://sourceforge.net/project/showf...group_id=63165

    and used

    Imports MySQLDriverCS

    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;" & _
    "Command Logging=false"
    cn = New MySQLConnection(fsConn)
    cn.Open()


    it appears to be working gr8

IMN logo majestic logo threadwatch logo seochat tools logo