Is it posible to connect my vb6.0 program to a wamp(mysql, myphpadmin) server on my pc. If i use my program to other part of our country, can i still connect to the wamp server? This is my challenge for a job, the IT personel from a company i am applying wants me to create a server based program.

Recommended Answers

All 9 Replies

As long as there is a connection between the computer and the server, whether it's intranet, or internet, you can make the program connect. The main question is changing the connection string to reflect a different server address, and possibly different credentials.

sir, my isp provides me dynamic ip address, how can i connect my program to wamp server through internet, please help me! im new to "ALL" ^^ i have an idea that it will need my ip address to be able to connect, i just feel it ^^ Please explain the flow >_<

as far as I can tell you'll have to change to a static IP( maybe a different ISP), or subscribe to a Dynamic DNS service. I have no personal knowledge of this but if you Google it there are plenty of links that can help you.

This will make the connection for you. Change the detail as needed...

Dim cnServer As ADODB.Connection
        Dim rsServer As ADODB.Recordset

        Set rsServer = New ADODB.Recordset
        Set cnServer = New ADODB.Connection

        cnServer.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
            & "SERVER=MyIPAddressOfServerHere;" _
            & "Port=3306;" _
            & "DATABASE=MyDatabaseNameHere;" _
            & "UID=MyServerUsernameHere;" _
            & "PWD=MyServerPasswordHere;" _
            & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

        cnServer.CursorLocation = adUseServer
        cnServer.Open

sir, i changed the port of the wamp to 8081, now i cant connect properly, i have no idea what causing the problem,
i dont have static ip so im testing it over LAN, if i run the program to other computer, it should connect to wamp running on another computer. But got an error. Please help me ^__^

sir what does this means?
"OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

im using MySql from oracle now, can i just put the ip address generated by my router for the server name? like 192.168.1.108 to test my connection to the other lan computer?

its funny but it worked through LAN, thank you all for the help, i think i will be needing an static ip add and some NASA level encryption(which i still dont have an idea to make ^__^) heres the code

Public cn As ADODB.connection
Public rs As ADODB.Recordset

Sub connection()

Set cn = New ADODB.connection

With cn
    .ConnectionString = "Driver={Mysql ODBC 3.51 Driver}; server=192.168.1.100; port=3307; database=2mhzbrain; user=2mhzbrain; password=EqUaL626; OPTION= 1 + 2 + 8 + 32 + 2048 + 16384;"
    .Open
    '.CursorLocation = adUseClient
    .CursorLocation = adUseServer
End With

End Sub

Only a pleasure. Glad you got it working.

Please mark this as solved, thanx.

I have exactly the same problem with the above problem but it just that my code is different. Please, sir i need your help on this. OS=windows 7, wamp(mysql, myphpadmin) server. below is my connection code:

Public con As New ADODB.Connection

Public recPurchase As New ADODB.Recordset
Public recPurchase2 As New ADODB.Recordset
Public recSales As New ADODB.Recordset
Public recUsers As New ADODB.Recordset
Public recItem As New ADODB.Recordset
Public recOrderHistory As New ADODB.Recordset

Public recInvoice As New ADODB.Recordset
Public recInvoice2 As New ADODB.Recordset
Public recInvoice3 As New ADODB.Recordset
Public recInvoice4 As New ADODB.Recordset
Public recInvoice5 As New ADODB.Recordset
Public recInvoice6 As New ADODB.Recordset
Public recInvoice7 As New ADODB.Recordset

Public recWaybill As New ADODB.Recordset
Public recWaybill2 As New ADODB.Recordset
Public recWaybill3 As New ADODB.Recordset
Public recWaybill4 As New ADODB.Recordset
Public recWaybill5 As New ADODB.Recordset
Public recWaybill6 As New ADODB.Recordset
Public recWaybill7 As New ADODB.Recordset

Public recOrder As New ADODB.Recordset
Public recOrder2 As New ADODB.Recordset
Public recOrder3 As New ADODB.Recordset
Public recOrder4 As New ADODB.Recordset
Public recOrder5 As New ADODB.Recordset
Public recOrder6 As New ADODB.Recordset
Public recOrder7 As New ADODB.Recordset
Public recOrder8 As New ADODB.Recordset

Public recReceipt As New ADODB.Recordset
Public recTransaction As New ADODB.Recordset

Public Sub ConnectMe()

On Error Resume Next

con.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=192.168.0.102;Database=furniture1; User=root;Password=; Port=3306 Option=1 + 2 + 8 + 32 + 2048 + 16384;"
con.Open
con.CursorLocation = adUseServer

recPurchase.Open "Select * from Purchase order by ModelNo", con, adOpenDynamic, adLockOptimistic
recSales.Open "Select * from Sales order by ModelNo", con, adOpenDynamic, adLockOptimistic
recUsers.Open "Select * from Users order by LoginId", con, adOpenDynamic, adLockOptimistic
recOrderHistory.Open "Select * from Order_History order by ModelNo", con, adOpenDynamic, adLockOptimistic
recItem.Open "Select * from Item order by ModelNo", con, adOpenDynamic, adLockOptimistic

recInvoice.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice2.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice3.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice4.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice5.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice6.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic
recInvoice7.Open "Select * from Invoice order by Invoice_No", con, adOpenDynamic, adLockOptimistic

recWaybill.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill2.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill3.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill4.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill5.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill6.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic
recWaybill7.Open "Select * from Sales_Order order by S_OrderNo", con, adOpenDynamic, adLockOptimistic

recOrder.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder2.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder3.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder4.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder5.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder6.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder7.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic
recOrder8.Open "Select * from Cust_Order order by Order_no", con, adOpenDynamic, adLockOptimistic


recReceipt.Open "Select * from Receipt order by DepositID", con, adOpenDynamic, adLockOptimistic

recTransaction.Open "Select * from Trans_Nos ", con, adOpenDynamic, adLockOptimistic

End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.