Jump to content

SQL (Server) Statement not working...


 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...