Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

can anyone help me?

I need instruction on how to connect to a database from another computer. the database is store in a host computer and i need to access the database from another computer. below is the code that i wrote but there's an error telling me that cannot connect to MySQL server on "xxx.xxx.xxx.xxx (xxxxx)"

Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

conn.CursorLocation = adUseClient
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=xxx.xxx.xxx.xxx;" _
& "DATABASE=testing;" _
& "UID=xxxxxx;" _
& "PWD=xxxxx;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

conn.Open

rs.Open "SELECT * FROM testdb WHERE 1=0", conn, adOpenStatic, adLockOptimistic

Please, help me.

Comments

  • cmf1cmf1 Posts: 9Member
    : I need instruction on how to connect to a database from another computer. the database is store in a host computer and i need to access the database from another computer. below is the code that i wrote but there's an error telling me that cannot connect to MySQL server on "xxx.xxx.xxx.xxx (xxxxx)"
    :
    : Set conn = New ADODB.Connection
    : Set rs = New ADODB.Recordset
    :
    : conn.CursorLocation = adUseClient
    : conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    : & "SERVER=xxx.xxx.xxx.xxx;" _
    : & "DATABASE=testing;" _
    : & "UID=xxxxxx;" _
    : & "PWD=xxxxx;" _
    : & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    :
    : conn.Open
    :
    : rs.Open "SELECT * FROM testdb WHERE 1=0", conn, adOpenStatic, adLockOptimistic
    :
    : Please, help me.
    :

  • cmf1cmf1 Posts: 9Member
    : : I need instruction on how to connect to a database from another computer. the database is store in a host computer and i need to access the database from another computer. below is the code that i wrote but there's an error telling me that cannot connect to MySQL server on "xxx.xxx.xxx.xxx (xxxxx)"
    : :
    : : Set conn = New ADODB.Connection
    : : Set rs = New ADODB.Recordset
    : :
    : : conn.CursorLocation = adUseClient
    : : conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    : : & "SERVER=xxx.xxx.xxx.xxx;" _
    : : & "DATABASE=testing;" _
    : : & "UID=xxxxxx;" _
    : : & "PWD=xxxxx;" _
    : : & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    : :
    : : conn.Open
    : :
    : : rs.Open "SELECT * FROM testdb WHERE 1=0", conn, adOpenStatic, adLockOptimistic
    : :
    : : Please, help me.
    : :
    :
    : First, I stop using ODBC connections for the more reliable ADO.
    In your Project components you'll find Microsoft ADO ....

    You can set it up on the form (be sure to make the Visible = False) so the user doesn't see it. This will also be where you set the recordset if this a bound data.
    Or in the code you can be more specific with your sSQL statement.

    ..sSQL = "Select * from tblNames where Status = 'A'"
    ..Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data _ &
    .. Source=C:direcorydata.mdb;Persist Security Info=False"
    ..Adodc1.RecordSource = sSQL
    ..On Error Resume Next
    ..Adodc1.Refresh



Sign In or Register to comment.