?
Solved

[DBNETLIB][ConnectionOpen (connect()).]SQL Server does not exist or access denied

Posted on 2005-05-16
6
Medium Priority
?
2,682 Views
Last Modified: 2013-12-25
i have a vb6 app conecting to a SQL Server 2000 DB

when i am loading data in to a table
using


Dim REC As New ADODB.Recordset
REC.ActiveConnection = dbconn

do while..... long loop goes few thousand times
  SQLstr = "INSERT INTO tblSourceData VALUES (" & _ ......
  Set REC = dbconn.Execute(SQLstr)
loop

it will work for a while then all of a sudden i get

Run-Time error '-2147467259 (80004005)':   [DBNETLIB][ConnectionOpen (connect()).]SQL Server does not exist or access denied


0
Comment
Question by:apinsonn
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
leonstryker earned 400 total points
ID: 14013426
First some suggestions.  Change your code to:
do while.....
  SQLstr = "INSERT INTO tblSourceData VALUES (" & _ ......
  dbconn.Execute SQLstr
loop

You really do not need the recordset object here.

Second, your connection looks like it is timing out.  Either increase the connection timeout value, or check to see if you have an active connection before performing the Insert.

Leon
0
 
LVL 3

Expert Comment

by:poaysee
ID: 14019399
May be you should publish your dbconn connection.
0
 

Author Comment

by:apinsonn
ID: 14019451
Public dbconn As New ADODB.Connection

lsConnString = "Provider=SQLOLEDB.1;Password=****;Persist Security Info=True;User ID=***;Initial Catalog=*****;Data Source=****"

dbconn.Open (lsConnString)
0
 
LVL 3

Expert Comment

by:poaysee
ID: 14020079
//This is for the trusted connection
dbconn.connectionstring= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & DatabaseName & ";Data Source=" & servername & """

or

//This is your connection
dbconn.connectionstring ="Provider=SQLOLEDB.1;Password=****;Persist Security Info=True;User ID=***;Initial Catalog=*****;Data Source=****"

dbconn.Open
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question