View Single Post
  #2 (permalink)  
Old January 24th, 2004, 04:48 AM
Aaron C. Edwards Aaron C. Edwards is offline
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't usually use the Execute method, but rather the Open method of the recordset object. But my gut tells me you don't have enough info to open the connection. For Jet databases, you need to specify the location of the database on the harddrive, either through an absolute reference, or using Server.Mappath. Here is an example connection to an Access database from my world...

Set cnXN = Server.CreateObject("ADODB.Connection")cnXN.Connec tionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\INetPub\wwwsites\MyWebsite\datasrc\MyWeb site.mdb"
cnXN.Open

Start with that. Then I'd look at my ADO command:

  Set cmd = Server.CreateObject("ADODB.Command")
  cmd.CommandType=adCmdText
  Set cmd.ActiveConnection = cnXN
  cmd.CommandText = "YOUR SQL QUERY GOES HERE"
  cmd.Execute

Or you could use the open method of the recordset object, as in

Set Rs= Server.CreateObject ("ADODB.RecordSet")
Rs.Open "YOUR SQL QUERY GOES HERE", cnXN, adOpenKeyset, adLockOptimistic

The last 2 properties determine what kind of cursor and reocordlocking you use. There are four options for each. You can get more info online.

Good luck!

Reply With Quote