Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

can't make an ADOCommnad.Execute work in IE 5

can't make an ADOCommnad.Execute work in IE 5

can't make an ADOCommnad.Execute work in IE 5

I'm beginning in VBScript, and tried a simple update query using SQL, but it doesn't work... on the line that calls the Execute of the ADOCommand.

is there something else I have to download or it's only that my code is all wrong?



RE: can't make an ADOCommnad.Execute work in IE 5

Doesn't ADO provide a read-only recordset by default? I think that you have to set the locking to optimistic?

RE: can't make an ADOCommnad.Execute work in IE 5

The Command object doesn't support an Execute method. In it's simpliest iteration, to update a DB with ADO...

Dim oConn, strSql, strConn
oConn = Server.Createobject("ADODB.Connection")
strConn = "DSN=Northwind;uid=sa;pwd=;"
oConn.Open strConn
strSql = "UPDATE customers SET contactname = 'Jeff' WHERE customerId = 'ALFKI'"
oConn.Execute strSql
Set oConn = Nothing

Note: I did not have to use the Command object, instead I called the execute method on the Connection object. FYI the command object is used primarily to optimize the command by setting command properties, (CommandType, CommandTimeout, etc.) and to access the Parameter collection if you're using stored procedures (although you don't really even need to do that to use stored procedures). You could optimize your ADO by creating a command object and then setting the ActiveConnection property and CommandType properties appropriately.

RE: can't make an ADOCommnad.Execute work in IE 5

I tried using the above code and I get a server error. On the oConn = Server.CreateObject("ADODB.Connection") line. Am I doing something wrong ?

Please reply to jbaker@tmctech.com


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close