• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1109
  • Last Modified:

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!
0
HunTelWebProgrammer
Asked:
HunTelWebProgrammer
  • 3
  • 2
1 Solution
 
John_LennonCommented:
try changing this
Set dboc =Server.CreateObject("ADODB.Command")

to this
Set dboc =Server.CreateObject("ADODB.Connection")
0
 
HunTelWebProgrammerAuthor Commented:
Still the same error....
/includes/add_comment.asp |8|800a01a8|Object_required:_'dboc' 80
0
 
John_LennonCommented:
sorry, try this
'################
set dboc = server.createObject("ADODB.Connection")
dboc.mode = 3
dboc.open "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)
'#####################3
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
walkerkeCommented:
On line 2 you have: dboc = "Driver={MySQL OD...

Shouldn't it be: dboc.ConnectionString = "Driver={MySQL OD...  ?
0
 
HunTelWebProgrammerAuthor Commented:
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!
0
 
John_LennonCommented:
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")
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now