Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: odbc vs oledb behavior


Message #1 by "Michael Goldman" <mg188@h...> on Wed, 21 Feb 2001 12:59:19 -0800
Hi,   Does oledb not allow calling sql statements from the db?



**********

With this conn string, I can call a query in the Access97 db:



dim objcon,ors

Set objCon = Server.CreateObject("ADODB.Connection")

objCon.Open "DSN=mg53rev1"

end function



set ors=objcon.execute("{call qpa2}")



***********

But with THIS conn string, I have to put my sql statements in the asp pages:



dim constr,objcon,sql

constr="provider=microsoft.jet.oledb.4.0; data

source=c:\inetpub\wwwroot\mg53rev1\mg53rev1.mdb"

Set objCon = Server.CreateObject("ADODB.Connection")

objcon.open constr



SQL= "SELECT DISTINCT tblact.ActNam AS actnam"

SQL=SQL&" FROM tblact INNER JOIN tblgrpev ON tblact.actid=tblgrpev.actid"

SQL=SQL&" WHERE tblgrpev.evid > 0 ORDER BY tblact.ActNam"

set ors=objcon.execute(SQL)



************

If I try calling the query (qpa2) while using the oledb version, I get this

error:



Microsoft JET Database Engine (0x80040E14)

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT',

or 'UPDATE'.





Am I missing something in the oledb conn string?



Thanks,



Mike




  Return to Index