Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 April 19th, 2005, 11:09 PM
Authorized User
 
Join Date: Aug 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Funky Error

Hey guys,

Here is my error :

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

It occurs when I am inserting records into SQL Server. Actually, it works just fine as long as I only insert like one or two thousand records. But, when I try to insert say 10,000 records, it busts. The records are in a loop and are being inserted one at a time. I am doing this in vba.

Here is the connection string:

Set cnn = New ADODB.Connection
    cnn.Open "Provider=sqloledb;" & _
    "Data Source=localhost;" & _
    "Initial Catalog=Customer;" & _
    "User Id=xxxxxxx;" & _
    "Password=xxxxx"


Any suggestions?


nikotromus
__________________
nikotromus
 
Old April 19th, 2005, 11:55 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Can you post all of your code in the loop?
 
Old April 21st, 2005, 08:51 PM
Authorized User
 
Join Date: Aug 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem as far as I can tell is not with the data. In fact, I have the exact same code working just fine with an Access database. I have tried different sets of data, and it always does the same thing. Around record 1970, it bombs out and gives the error message I mentioned above. It is almost like there is some sort of limit to how many times you can connect to the database. I have spent hours trying to figure out what is going on here.

Here is the code below:

Dim cnn As ADODB.Connection
Call GetCnn(cnn)
Dim strqry As String

'INSERT RECORD INTO CALL LIST
Dim rsAction As ADODB.Recordset
Set rsAction = New ADODB.Recordset
rsAction.ActiveConnection = cnn

DIM CtrNumberToPull As Double

Dim branch1 As Double
Dim branch2 As Double

branch1 = rsBranches("Branch")
branch2 = branch1

Dim intFile As Integer
intFile = FreeFile
Open CurDir & "\ErrorLog.Txt" For Append Shared As intFile

While Not rsBranches.EOF
     CtrNumberToPull = rsBranches("NumberToPull")
     While rsBranches("bank") = rsData("bank") And rsBranches ("Branch") = rsData("branch")
            'INSERT INTO CALL LIST WHILE NUMBER TO PULL IS GREATER THAN 0
            If CtrNumberToPull > 0 Then
               strqry = "INSERT INTO tbl_CallList ([TransNum], [Bank], [Branch], [Phone], [OfficialBranchName], [Address], [City], [Date_1]) " & _
                        " VALUES (" & rsData("TransNum") & " , '" & rsData("Bank") & "', " & _
                        " " & rsData("Branch") & ", '" & rsData("Phone") & "', " & _
                        " '" & Replace(rsData("OfficialBranchName"), "'", "''") & "','" & Replace(rsData("Address"), "'", "''") & "', " & _
                        " '" & Replace(rsData("City"), "'", "''") & "', '" & rsData("Date_1") & "')"
                        rsAction.Open (strqry)
            End If

            Write #intFile, rsData("bank"), rsData("Branch")
            rsData.MoveNext

            If rsData.EOF Then
               GoTo here
            End If

            CtrNumberToPull = CtrNumberToPull - 1
          Wend

       rsBranches.MoveNext

    Wend

here:

nikotromus
 
Old April 27th, 2005, 12:32 AM
Authorized User
 
Join Date: Aug 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out. The connection I use above connect over and over and over again until the memory fills up and it crashes. I changed the connection to open until the loop ends, and then close at the end.

Wow, this is the first time i've ever had a question that didn't at least attempt to get answered on this site. Ya'll are slackin! :)

Thanks,

Ryan


nikotromus
 
Old April 27th, 2005, 01:13 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had the same error on a desktop application which was exporting out a large amount of records from a database to xml.

I changed from using tcp/ip to named pipes and the error stopped.

I would have liked to have done what you did but time didnt permit but its nice to know it works.

Mylin



Quote:
quote:Originally posted by nikotromus
 I figured it out. The connection I use above connect over and over and over again until the memory fills up and it crashes. I changed the connection to open until the loop ends, and then close at the end.

Wow, this is the first time i've ever had a question that didn't at least attempt to get answered on this site. Ya'll are slackin! :)

Thanks,

Ryan


nikotromus





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
[Resolved] Error calling a sp - parameter error snufse .NET Framework 2.0 2 February 12th, 2008 04:46 PM
VB Error: Syntax Error or Access Violation codehappy VB How-To 7 October 3rd, 2007 05:41 PM
Funky - Login Failed for user 'Domain\UserId' erro jnks2005 ASP.NET 2.0 Basics 5 February 26th, 2007 01:38 PM





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