Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2008, 10:32 PM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ado.connectionstring


I try to connect a server via IP address but I didn't.
My server is in LAN network. The address of router is 222.252.96.159 and address of myserver in LAN 10.0.0.3 My connectionstring is

CN2.ConnectionString = "Driver={SQL Server};" & _
           "Server=222.252.96.159;" & _
           "Address=10.0.0.3,1433;" & _
           "Network=DBMSSOCN;" & _
           "Database=Pubs;" & _
           "Uid=sa;" & _
           "Pwd="

Any problems ?

Tran Tuan An.


 
Old November 5th, 2008, 03:40 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

http://www.carlprothman.net/Default....erForSQLServer

I have no idea why you are using ADDRESS= there.

And the 1433 belongs on the Server, but you really don't need it since that's the default.
 
Old November 6th, 2008, 09:34 PM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help, Old Pedant.

Infact, the syntax of this connectionstring is:
CN2.ConnectionString = "Driver={SQL Server};" & _
           "Server=x.x.x.x;" & _
           "Address=x.x.x.x,1433;" & _
           "Network=DBMSSOCN;" & _
           "Database=Pubs;" & _
           "Uid=sa;" & _
           "Pwd="
but I didn't connect with

CN2.ConnectionString = "Driver={SQL Server};" & _
           "Server=222.252.96.159;" & _
           "Address=222.252.96.159,1433;" & _
           "Network=DBMSSOCN;" & _
           "Database=Pubs;" & _
           "Uid=sa;" & _
           "Pwd="
or
CN2.ConnectionString = "Driver={SQL Server};" & _
           "Server=10.0.0.3;" & _
           "Address=10.0.0.3,1433;" & _
           "Network=DBMSSOCN;" & _
           "Database=Pubs;" & _
           "Uid=sa;" & _
           "Pwd="

so i tryed that. And the port of sql server is default (1433).

I worry about ado don't support this case. That is true ?

Tran Tuan An

 
Old November 7th, 2008, 08:26 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Is there a reason you must use the IP information to connect to the database? I usually use this sort of connection string with no problems:

cn.Open "Provider=SQLOLEDB;Data Source=SERVERNAME;Initial Catalog=DATABASENAME;UID=USERID;PWD=PASSWORD"






mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old November 7th, 2008, 04:54 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

That's what I was trying to ask, also. Why is the ROUTER address important, at all??? Why is it in there?





Similar Threads
Thread Thread Starter Forum Replies Last Post
where to put my connectionstring pascali70 C# 10 June 22nd, 2007 05:09 AM
the ConnectionString Property... coolb C# 3 September 26th, 2006 02:05 AM
ConnectionString not initialized samiboy ASP.NET 2.0 Basics 2 April 30th, 2006 06:18 AM
The ConnectionString property...! rajesh0363 All Other Wrox Books 2 July 26th, 2005 01:55 PM
DAo & ADO & connectionstring dr_morose Access VBA 5 November 17th, 2004 05:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.