Solved

ActiveConnection property error...0x800A0E7B or Syntax violation error :0x80040E14

Posted on 2003-11-25
1
1,007 Views
Last Modified: 2007-12-19
I am using cursors on my stored procedures. On the asp side, i use a Visual Basic Dll containing the following code for the database connection..

Function sp(ByVal SP As String, ParamArray params() As Variant) As ADODB.Recordset
    Dim rs As ADODB.Recordset, cmd As ADODB.Command
    Set rs = New ADODB.Recordset
    Set cmd = New ADODB.Command
     cmd.ActiveConnection = ...
    cmd.CommandText = SP
    cmd.CommandType = adCmdStoredProc
'note : if i change this to cmd.CommandType = adCmdText then i get the syntax error message on the asp page:
'(0x80040E14)Syntax error or access violation

     collectParams cmd, params
    rs.CursorLocation = ...
    rs.Open cmd, , adOpenForwardOnly, adLockReadOnly

    Set cmd.ActiveConnection = Nothing
    Set cmd = Nothing
    Set rs.ActiveConnection = Nothing

'return the damn recordset :(    
Set sp= rs
End Function


Now in many cases i have seen that when i use the dll to run my stored procedures and return recordsets, the page breaks and i get the following error:
 (0x800A0E7B)
Cannot change the ActiveConnection property of a Recordset object which has a Command object as its source.

or

Syntax error or access violation..

I get stuck on this error .. and in most of these stored procedures, I use either multiple select statements (not to return values, but to assign inner variables..)
for example : i use the following in a cursor..

set @Exists = (Select @myvar where @myvar in (Select myvarfield from [tablename] where <condition>
                  Inner Join table1 ON <condition>))

Query analyzer returns perfect values, but only my asp page breaks..and i have really got fed up of this error..have almost become paranoid of it ..

help me fast...please..SOS
DeEl In ThE DiGiTaLL WoRlD

0
Comment
Question by:digitaleel
1 Comment
 
LVL 7

Accepted Solution

by:
wsteegmans earned 250 total points
ID: 9821456
I think this line occurrs the problem.

    Set cmd.ActiveConnection = Nothing
    Set cmd = Nothing
    Set rs.ActiveConnection = Nothing       <-----------------

You already set the ActiveConnection to nothing by doing this:
    Set cmd.ActiveConnection = Nothing

Because the recordset uses a command object, it has no active connection, the command object does. So, when you set the ActiveConnection of the Command to nothing, you doesn't have to do it again for the Recordset.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Join 9 61
SQL Server Web Traffic Limitations 4 53
Dreamweaver server behavior gone 6 110
ASP Classic - Load test 2 44
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now