dbTalk Databases Forums  

Re: Time out error in my activex script that updates records.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: Time out error in my activex script that updates records. in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Time out error in my activex script that updates records. - 01-22-2004 , 02:55 PM






Why do you need to do this in an Active Script task?

This will work

--Set to 0 where datecolumn date is yesterday or before

UPDATE Table SET MemberCircle = 0 where DATEDIFF(day,getdate(),DateColumn)
<0

--Set to 0 where datecolumn date is Less than NOW (even a second)

UPDATE Table SET MemberCircle = 0 where DateColumn < Getdate()




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Teresa" <tmeadows (AT) arizonatc (DOT) com> wrote

Quote:
Hello i'm new to using DTS, but now new to vb, vb script and database
programming. I'm getting this weird time out error when i try to up a
record. what this script does it gets a recordset of all the customers then
checkes their expiration date. if the expiration date has pass it will then
update that customers member cirlce to 0. on the very first update is where
i'm getting the time out error. Can some please shed some light into why
this is happenning and how i can fix it. Here is my code
Quote:
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()


set myConn = CreateObject("ADODB.Connection")

set myRecordset = CreateObject("ADODB.Recordset")

myConn.Open = "Provider=SQLOLEDB.1;Data Source=(local);
Initial Catalog=Forté;user id = 'forteDBuser';password='userpassword'"



strSelect = "SELECT * FROM Customers"

set myRecordset = myConn.Execute(strSelect)

while not myRecordset.EOF

if not isNull(myRecordSet("CircleExpirationDate")) then

if DateDiff("d",
myRecordSet("CircleExpirationDate"), Date) > 366 then

strUpdate = "UPDATE Customers SET
MemberCircle = 0 WHERE CustomerId = " & myRecordset.Fields("CustomerId")

msgbox strUpdate

myConn.execute strUpdate

msgbox "got here"

end if

end if

myRecordset.MoveNext

wend

Main = DTSTaskExecResult_Success

End Function





Reply With Quote
  #2  
Old   
Teresa
 
Posts: n/a

Default Re: Time out error in my activex script that updates records. - 01-22-2004 , 08:11 PM






Thank you very. I tired that and it worked. Thank you again
But do you or anybody know why i was getting that timeout error. I would just like to know for the future
I guess i was trying to make this problem a little to difficult. Thanks again, allan.

Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Time out error in my activex script that updates records. - 01-23-2004 , 12:07 AM



You could try setting a larger timeout value on the connection


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Teresa" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thank you very. I tired that and it worked. Thank you again.
But do you or anybody know why i was getting that timeout error. I would
just like to know for the future.
I guess i was trying to make this problem a little to difficult. Thanks
again, allan.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.