November 19, 2002 at 2:51 pm
ever see this?
"This object has been detached from SQLDMO, as the result of a refresh, automatic shutdown, error, or App.Quit."
context
For Each sqltable In g_objSQLServer.Databases(g_strDatabaseName).Tables
debug.print sqltable.name
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
November 19, 2002 at 7:11 pm
No but see if either of these threads are helpfull.
November 19, 2002 at 9:03 pm
quote:
No but see if either of these threads are helpfull.http://dbforums.com/archives/t259554.html
http://dbforums.com/archives/t259554.html
thx - these posts weren't really helpful but I appreciate the post.
this hampers some users but not others. I suspect something is causing sqldmo client to disconnect from the server in the middle of processing. hopefully i'll get more info. from users. I see this bug one every couple of months
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
November 20, 2002 at 3:39 am
I had this when I inadvertently reset the connection have you tried
dim d as sqldmo.database
set d = g_objSQLServer.Databases(g_strDatabaseName)
For Each sqltable In d.Tables
debug.print sqltable.name
next
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 20, 2002 at 8:57 am
quote:
I had this when I inadvertently reset the connection have you trieddim d as sqldmo.database
set d = g_objSQLServer.Databases(g_strDatabaseName)
For Each sqltable In d.Tables
debug.print sqltable.name
next
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
no - but i think you are correct on the nature of the issue. dmo is getting disconnected for some reason.
is there any inherent value in declaring/setting the dmo values as you have suggested over what i did. I have no personal preference but wanted to know if there was a reason for one method over another.
thanks
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
November 20, 2002 at 9:58 am
The problem I had was that I was calling a property of a com wrapper that returned a SQLDMOSQLServer. The problem was that in my code I was reseting the connection everytime I returned the object, this meant that any objects previously created off the server object are invalid.
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 20, 2002 at 10:03 am
quote:
The problem I had was that I was calling a property of a com wrapper that returned a SQLDMOSQLServer. The problem was that in my code I was reseting the connection everytime I returned the object, this meant that any objects previously created off the server object are invalid.Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
what is curious to me is that my code WORKS on 99 out of 100 installs but some users experience this issue.
From what I gather the error can be duped programmatically by simply disconnecting the instance of sqldmo server (or destroying it or letting it go out of context).
but there must also be an external factor that can also trigger this error. perhaps if the server went down while this loop was going the sqldmo server would be, in essence, destroyed/disconnected, and this error would result.
my dilemna now is to determine why on one customers machine sqldmo server would get disconnected in such a way.
i appreciate your responses to my posts.
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
November 20, 2002 at 10:29 am
How long does it take to run? could it be disconnecting automatically?
Can you paste more code?
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 20, 2002 at 2:22 pm
quote:
How long does it take to run? could it be disconnecting automatically?Can you paste more code?
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
it runs quickly but more information ...
of entire app. and many places where DMO is used it fails in the SAME place everytime. I have had 3 reports of this error and each one fails on same line of code. 43 - see below.
But note the "DoEvents" immedietly before it. I believe that this is the culprit - in some way releasing the reference from memory as it frees up some memory for other processes. which is what DoEvents does in VB.
33 For Each sqltable In g_objSQLServer.Databases(g_strDatabaseName).Tables
34 If g_bolCancel = True Then
35 GoTo PROC_EXIT
36 End If
37 If sqltable.SystemObject = True Then
38 GoTo SKIP2END
39 ElseIf sqltable.Name Like (strPrefix & "*") Then
40 GoTo SKIP2END
41 End If
42 DoEvents
43 strTblName = sqltable.Name
44 strOwnName = sqltable.Owner
Brian Lockwood
President
LockwoodTech Software
Brian Lockwood
President
ApexSQL - SQL Developer Essentials
November 20, 2002 at 3:02 pm
I think you have it. Can't see any other reason why it would do it.
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 21, 2002 at 7:50 pm
My two cents on declaring the objects. If Im going to use it more than once I typically declare and use it. Same idea as using a with block, want to do the minimum property lookups (dots in the syntax). Doubt that overall its much difference in performance, but in a hard loop it might net you a little.
Andy
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply