Re: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE
From: Jack (Jack_at_discussions.microsoft.com)
Date: 12/13/04
- Next message: Jack: "One Access stored query works fine while the other does not. Need"
- Previous message: Bob Barrows [MVP]: "Re: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', '"
- In reply to: Bob Barrows [MVP]: "Re: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', '"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Dec 2004 10:45:15 -0800
Thanks for the detailed help. Really appreciate it. Thanks.
"Bob Barrows [MVP]" wrote:
> Jack wrote:
> > Hi, I am trying to connect to a local Access Data from
> > a ASP page. I do not have the latest version of JET 4.0 installed.
>
> Why not?
>
> > Hence I am trying to use the native ODBC driver for Access:
>
> When you get it installed, you'll want to change the connection string to
> use the native Jet OLEDB provider.
>
> > The
> > following is the code for opening the sql. The z_SpecialCondition
> > query is an Access query which is basically 'select * from
> > SpecialCondition'. However, when I am trying to run the ASP page I am
> > getting the following error
> > message given below. I would like to know, why is this error message
> > coming. Thanks.
> >
> >
> > <%
> > myDSN="DRIVER={Microsoft Access Driver (*.mdb)}; "
> > myDSN=myDSN & "DBQ=C:\_______GWISNEWCON\GMISDATA.mdb"
> >
> > set CN=server.createobject("ADODB.Connection")
> > set RS=server.createobject("ADODB.Recordset")
> > CN.Open myDSN
> > RS.ActiveConnection=CN
>
> This should be:
> Set rs.activeconnection=cn
>
> By failing to use Set, you cause a new connection to be opened. Better yet,
> delete this line entirely.
>
> > SQL = "z_SpecialCondition"
>
> This should be
> "Select <list of columns, do not use * in production code> from " & _
> "z_SpecialCondition"
>
> > RS.Open SQL
>
> If you take my advice about deleting the ActiveConnection line, this line
> should be:
>
> rs.open sql,cn,,,1
>
> Once you get Jet 4.0 installed, you will be able to use this syntax to open
> your saved queries:
>
> cn.z_SpecialCondition rs
>
> See these posts for more info:
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&selm=eHYxOyvaDHA.4020%40tk2msftngp13.phx.gbl
>
> http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&selm=ukS%246S%247CHA.2464%40TK2MSFTNGP11.phx.gbl
>
> http://www.google.com/groups?selm=eETTdnvFDHA.1660%40TK2MSFTNGP10.phx.gbl&oe=UTF-8&output=gplain
>
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>
- Next message: Jack: "One Access stored query works fine while the other does not. Need"
- Previous message: Bob Barrows [MVP]: "Re: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', '"
- In reply to: Bob Barrows [MVP]: "Re: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', '"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|