Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


VBS - ADODB 3709 error


VBS - ADODB 3709 error

Author
Message
schleep
schleep
Mr or Mrs. 500
Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)

Group: General Forum Members
Points: 520 Visits: 1288
Well if I'm understanding this -- and to be honest, I'm on very thin ice -- I can't check the state of the connection in my original code as suggested by batesview


conStr="Provider=sqloledb;Data Source=<SQLServer2008>;Initial Catalog=<mydb>;Integrated Security=SSPI"
Set cmdObj=createobject("adodb.command")

On Error Resume Next
' if cmdObj.State = 1 then
With cmdObj
.activeconnection=conStr
--blah
End with

because I haven't actually opened a connection -- only instantiated a command object.

Are you suggesting that, from your example, I could check the state of the oConn object (not the command object), since that one is established before the command is executed?

I'll follow up on that if I see more 3709's.

Thanks folks.



batesview
batesview
SSC Rookie
SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)SSC Rookie (32 reputation)

Group: General Forum Members
Points: 32 Visits: 422
Oops on my part, this is the code I've been 'working' on am I looking at the wrong thing?

[code ="vb"]
strInput = <a string that is the parameter for my stored proc dbo.AddRecord>

conStr="Provider=sqloledb;Data Source=<SQLServer2008>;Initial Catalog=<mydb>;Integrated Security=SSPI"
Set cmdObj=createobject("adodb.command")

On Error Resume Next

With cmdObj
.activeconnection=conStr
.commandtimeout = 0
.commandtype=4
.commandtext="dbo.AddRecord"
.parameters.refresh
.parameters(1).value=strInput
.execute
End with

If Err.Number <> 0 Then
objLogFile.WriteLine "---" & Err.Number & " Srce: " & Err.Source & " Desc: " & Err.Description
objLogFile.WriteLine "---EXECUTE dbo.AddRecord " & strInput
Err.Clear
else
cmdObj.close
end if
[/code]
What should I be looking at ?
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16582 Visits: 17024
schleep (2/27/2014)
Well if I'm understanding this -- and to be honest, I'm on very thin ice -- I can't check the state of the connection in my original code as suggested by batesview


conStr="Provider=sqloledb;Data Source=<SQLServer2008>;Initial Catalog=<mydb>;Integrated Security=SSPI"
Set cmdObj=createobject("adodb.command")

On Error Resume Next
' if cmdObj.State = 1 then
With cmdObj
.activeconnection=conStr
--blah
End with

because I haven't actually opened a connection -- only instantiated a command object.

Are you suggesting that, from your example, I could check the state of the oConn object (not the command object), since that one is established before the command is executed?

I'll follow up on that if I see more 3709's.

Thanks folks.


Yes exactly. Using my code you would have an explicit connection which would let you check of the connection object. ;-)

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
schleep
schleep
Mr or Mrs. 500
Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)

Group: General Forum Members
Points: 520 Visits: 1288
9:15 and all's well with the explicit connection object... :-)

We'll see what happens next week.



schleep
schleep
Mr or Mrs. 500
Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)

Group: General Forum Members
Points: 520 Visits: 1288
No joy, still getting between 0 and 2 3709's / day, out of 30-40 executions.

I've now added a loop to check the state of the connection object, it cycles 10 times looking for an open state, otherwise sets object to nothing and creates a new one.

We'll see what happens next week.



schleep
schleep
Mr or Mrs. 500
Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)Mr or Mrs. 500 (520 reputation)

Group: General Forum Members
Points: 520 Visits: 1288
Some improvement, but still got one 3709.

I'd *love* to understand what's causing the error.



Chris Wooding
Chris Wooding
Old Hand
Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)Old Hand (333 reputation)

Group: General Forum Members
Points: 333 Visits: 935
My 2 penn'orth; I think the error you're getting is from an attempt to execute the stored proc with a connection that isn't open so you're not seeing the message associated with failing to open the connection in the first place. You need to replace "On Error Resume Next" with "On Error GoTo <some local error handler>. In the error handler, you can check the actual connection failure message which may give you a clue as to what's going on. You could still allow a certain number of failure iterations before giving up entirely.
annasharpe31
annasharpe31
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
Using those code will help you.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search