Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect to SQl server throug ADO???

Status
Not open for further replies.

Nikolaj

Programmer
Jun 14, 2000
36
0
0
DK
Hi!!<br><br>I have a client that is NOT logged on to the machine with the SQL server on! Nothing that has anything to do with the SQL server is installed on the client!!<br><br>Why can't i connect to the SQL server??? Is it a problem like the problem conserning DCOM??? That is really a pain in the Ass!!<br><br>What am I doing wrong??<br><br>Regards<br><br>Nikolaj
 
How are you trying to connect to SQL server <br>Is it through a VB app using ADO <br><br>if so it could be several things can you post your source<br><br>things to check<br><br>MDAC 2.1 is installed <br>VB is running service pack 3<br>and if it is windows 9x then DCOM 98 should be installed <br><br><br>hope this helps <br><br>
 
Hi!<br><br>Yes Im trying to connect to the SQL server through ADO in a VB applikation.<br><br>Im running WinNt Service Pack 5.0<br><br>Here is how im trying to connect to the SQL server<br><br>If (Connection Is Nothing) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim str As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Set Connection = New ADODB.Connection<br>&nbsp;&nbsp;&nbsp;&nbsp;str = &quot;Provider=SQLOLEDB.1;Persist Security Info=False;User ID=ninc;Initial Catalog=TimeIT2;Data Source=TEST_PC3&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Connection.Open str, &quot;ninc&quot;, &quot;ninc&quot;<br>&nbsp;&nbsp;End If<br><br>When I do this I get this error!<br><br>&quot;Run-time error '-2147467259 (80004005)':<br>&nbsp;[DBNMPNTW]ConnectionOpen (CreateFile()).&quot;<br><br><br>Thanks i advance!<br>Regards<br><br>Nikolaj<br>
 
Hi!!<br><br>I solved the problem myself!<br><br>In Client Configuration in the ODBC Source in the Control Panel should the Network Libraries be set to TCP/IP!!<br><br>So that solves the actual problem!!<br><br>But;<br><br>Do you know how to set this from a VB Application???<br><br>It is bulls... if this have to be set on every machine because we have about 500 clients!!<br><br>Regards<br><br>Nikolaj<br><br>
 
I don't tend to use datasources for large client server apps for just this reason. You could try connecting directly from your application to your SQL server <br><br>You can do this by replacing the datasource name with the name of the Server <br><br>this way you should only have to make the one change to effect connection through all 500 hundred clients<br><br><br>hope this helps <br><br>
 
Hi again!<br><br>Im not using ODBC data Source! I just wanted to see if it was possible to connect through that. But it wasnt untill I set the TCP/IP setting!!<br><br>I am doing a direct connection throug ADO from VB but my problem is that the TCP/IP setting is wrong so no connection is possible! That was why I had to use the ODBC data source to correct this setting! OK??<br><br>Regards<br><br>Nikolaj<br><br>
 
Hi Nikolaj,<br><br>From reading your code, you are connecting through ODBC. The fact that you have to change settings in your DSN to get the connection working proves it. I agree with Vince, use OLE DB instead....... <p>Cal<br><a href=mailto: > </a><br><a href= > </a><br>
 
Hi!!<br><br>What the heck are you talking about!! Im not using the ODBC data source!! Where in my code can you see that im using the ODBC data source??<br><br><br>If im wrong please tell me how not to use ODBC!!!??<br><br><br>Nikolaj
 
In one of your posts above you say:<br><br>In Client Configuration in the ODBC Source in the Control Panel should the Network Libraries be set to TCP/IP!!<br><br>This reads like you are going into the configure option of you ODBC DSN.<br><br> <p>Cal<br><a href=mailto: > </a><br><a href= > </a><br>
 
Ok! It might look as Im using the ODBC!! But I think its a General setting not just a ODBC setting. It is just set from the ODBC DataSource! <br><br>It has to be possible to set this setting from a VB or something else!!<br><br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top