Link to home
Start Free TrialLog in
Avatar of HunTelWebProgrammer
HunTelWebProgrammerFlag for United States of America

asked on

Simple ASP Issue

I am developing an application on a Chilisoft ASP Enabled web server and am trying to execute a seeminlyu simple peice of code and getting failures every time.

Here is the code....

      Set dboc =Server.CreateObject("ADODB.Command")
      dboc = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=somedb;UId=123;Password=xyz;option=16386;"

      sql="INSERT INTO comments(name)"
      sql = sql & " VALUES ('" & request.form("name") & "')"
      dboc.Execute(sql)

It fails on the final line each time saying

800a01a8 | Object_required:_'dboc' 80


Any help would be great!  Thanks!
Avatar of John_Lennon
John_Lennon

try changing this
Set dboc =Server.CreateObject("ADODB.Command")

to this
Set dboc =Server.CreateObject("ADODB.Connection")
Avatar of HunTelWebProgrammer

ASKER

Still the same error....
/includes/add_comment.asp |8|800a01a8|Object_required:_'dboc' 80
ASKER CERTIFIED SOLUTION
Avatar of John_Lennon
John_Lennon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
On line 2 you have: dboc = "Driver={MySQL OD...

Shouldn't it be: dboc.ConnectionString = "Driver={MySQL OD...  ?
John_Lennon

Thank goodness that worked.  I have been using that peice of code for nearly 3 years with sucess all the time on IIS.  Is this something that is specific to Chilisoft ASP?  Could you please describe the what you reccomeneded so I know for future refrence.  

Thanks loads!  I have been fighting this for a coupel days!
glad to help

################
set dboc = server.createObject("ADODB.Connection") '--> You create the object as an ADODB Connection

dboc.mode = 3 '---> 3 means permission to read, write, you also can use 1 for read-only and 2 for write-only

dboc.open "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=somedb;UId=123;Password=xyz;option=16386;" '---> You open the connection using your connection string

sql="INSERT INTO comments(name)"
sql = sql & " VALUES ('" & request.form("name") & "')"

dboc.Execute(sql) '---> execute the query (sql) with the connection (dboc)
'#####################

actualy, i have never use
Set dboc =Server.CreateObject("ADODB.Command")
so i don't know how this work, i always use
set dboc = server.createObject("ADODB.Connection")