Jump to content
Sign in to follow this  
IndyUK

SQL (Server) Statement not working...

Recommended Posts

IndyUK

Hi All,

I'm putting together a script to update one of our SQL Servers. However, AutoIT keeps failing at the Insert statement. Here's the code:

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")

The error I get is:

C:\AutoIt_Projects\psftp.au3 (225) : ==> The requested action with this object has failed.:

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")^ ERROR

I think it's something to do with the way the date and time is being hadnled, or not handled. I've tried to enclose the value in single and double quotes, square brackets but to no avail. Has anyone come across this before? Any work-arounds?

Thanks

Share this post


Link to post
Share on other sites
PsaltyDS

Hi All,

I'm putting together a script to update one of our SQL Servers. However, AutoIT keeps failing at the Insert statement. Here's the code:

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")

The error I get is:

C:\AutoIt_Projects\psftp.au3 (225) : ==> The requested action with this object has failed.:

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")

$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values 20000, 17/08/2009 12:00:00")^ ERROR

I think it's something to do with the way the date and time is being hadnled, or not handled. I've tried to enclose the value in single and double quotes, square brackets but to no avail. Has anyone come across this before? Any work-arounds?

Thanks

Maybe:
$dst = $conn.Execute("Insert Into InteractionHistory (ID, Date) Values (20000, '17/08/2009 12:00:00')")

Not tested, but you have to delimit the values somehow or other.

>_<


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×