dsn on other computer of the same lan

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 20
Reputation: sal21 is an unknown quantity at this point 
Solved Threads: 0
sal21 sal21 is offline Offline
Newbie Poster

dsn on other computer of the same lan

 
0
  #1
Jul 14th, 2009
Hi friend i use this code to connect via vb6 a mysql database in local.

Is possible to connect other pc with the same code on the dsn on original pc where reside the dsn?



Tks for all and sorry for my bad english i'm italian.



Sub uno()

Dim conn As ADODB.Connection, rec As ADODB.Recordset

Set conn = New ADODB.Connection

Set rec = New ADODB.Recordset

conn.Open "Dsn=test"

rec.Open ("select * from staff"), conn, adOpenStatic, adLockReadOnly

Debug.Print rec.Fields(0)

Debug.Print rec.Fields(1)

rec.Close

conn.Close

Set conn = Nothing

End Sub



note:

i know the ip od pc where is the dsn
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 7
Reputation: jinnie_gia is an unknown quantity at this point 
Solved Threads: 0
jinnie_gia jinnie_gia is offline Offline
Newbie Poster

Re: dsn on other computer of the same lan

 
0
  #2
Jul 14th, 2009

Hi there,
Try the followin to solve the problem..Let me know...
You can adopt this plan.
under control panel, ODBC, create a new DSN (data service Name) point to the access database, enter the user id and password.
and save it after naming it say Test.

use this code in the vb project;

Option Explicit
Dim conn As ADODB.Connection, rec As ADODB.Recordset
'under control panel_odbc create a DSn called Jinnie_test. point it to mdb file and enter user id and password
Private Sub Command1_Click()
Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
conn.Open "Dsn=test" ' test is the DSN Name.
rec.Open ("select * from testable2"), conn, adOpenStatic, adLockReadOnly
Text1 = rec.Fields(0)
Text2 = rec.Fields(1)
rec.Close
conn.Close
Set conn = Nothing
End Sub


Take Care..Buddy..


Originally Posted by sal21 View Post
Hi friend i use this code to connect via vb6 a mysql database in local.

Is possible to connect other pc with the same code on the dsn on original pc where reside the dsn?



Tks for all and sorry for my bad english i'm italian.



Sub uno()

Dim conn As ADODB.Connection, rec As ADODB.Recordset

Set conn = New ADODB.Connection

Set rec = New ADODB.Recordset

conn.Open "Dsn=test"

rec.Open ("select * from staff"), conn, adOpenStatic, adLockReadOnly

Debug.Print rec.Fields(0)

Debug.Print rec.Fields(1)

rec.Close

conn.Close

Set conn = Nothing

End Sub



note:

i know the ip od pc where is the dsn
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 20
Reputation: sal21 is an unknown quantity at this point 
Solved Threads: 0
sal21 sal21 is offline Offline
Newbie Poster

Re: dsn on other computer of the same lan

 
0
  #3
Jul 14th, 2009
Originally Posted by jinnie_gia View Post

Hi there,
Try the followin to solve the problem..Let me know...
You can adopt this plan.
under control panel, ODBC, create a new DSN (data service Name) point to the access database, enter the user id and password.
and save it after naming it say Test.

use this code in the vb project;

Option Explicit
Dim conn As ADODB.Connection, rec As ADODB.Recordset
'under control panel_odbc create a DSn called Jinnie_test. point it to mdb file and enter user id and password
Private Sub Command1_Click()
Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
conn.Open "Dsn=test" ' test is the DSN Name.
rec.Open ("select * from testable2"), conn, adOpenStatic, adLockReadOnly
Text1 = rec.Fields(0)
Text2 = rec.Fields(1)
rec.Close
conn.Close
Set conn = Nothing
End Sub


Take Care..Buddy..
Tks...for sugestion i know this way.
But the dsn is on other computer not is located in the pc where i run the code(?!)....
How to the script know the ip/pc/ name where the dsn is saved?
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 828
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 150
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: dsn on other computer of the same lan

 
0
  #4
Jul 14th, 2009
1st, if you need to, install the MySQL drivers on the other machine.
2nd, create the ODBC DSN on the other machine to point to your instance of MySQL.
3rd, create an install package with the PDW or Inno and instal program on other computer.

Or to answer your question more directly...

No you cannot have a program on another computer access your ODBC DSN. It needs to be created on the other computer.


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC