8 messages in com.mysql.lists.win32Re: HELP Dynamic Where Clause from ASP
FromSent OnAttachments
N Gangadhara Sanya24 May 2004 07:14 
Erich Dollansky24 May 2004 07:59 
Daniel Clark24 May 2004 12:07 
N Gangadhara Sanya25 May 2004 01:14 
Ryszard Szklennik25 May 2004 01:37 
Ron Steiner25 May 2004 04:02 
Erich Dollansky25 May 2004 04:49 
Leif Johnston25 May 2004 06:05 
Subject:Re: HELP Dynamic Where Clause from ASP
From:Ryszard Szklennik (rs@prince.lv)
Date:05/25/2004 01:37:06 AM
List:com.mysql.lists.win32

Try this:

sSql = "Select * from candidate_mis where " & trim(Request.Form("txtCandID")) & " < candidateid;"

or use Chr(62) for ">" as I'm afraid ASP may be interpreting ">" as a terminator, resulting in an invalid MySQL statement.

Thank you Erich, Jerry, and Daniel for trying to help me. Unfortunately the problem still persists.

If my SQL Statement is "Select * from candidate_mis;" I get the needed results. Only when I included the where clause it started troubling me. The same Connectionstring & SQL Statement work perfectly if I call it from a VB application instead !!!

Hi Erich, If remove the ";" at the end it fails to execute the statement.(Even the above one)

Hi Jerry, This is how I am forming the SQL Statement.

sSql = "Select * from candidate_mis where candidateid > " & trim(Request.Form("txtCandID")) & ";"

Hi Daniel, Since if remove the where clause I am getting the results its not the question of selecting the database. It must be something else.

Since simple select statement is working there should not be any problem of communicating from ASP/IIS/MDAC2.8. There must be some problem at the mysql end. The error it gives is

Provider error '80040e37' Table does not exist.

/testmysql.asp, line 15

Is there any way I can know how MySQL recieved the statement. May be some log files which could probably contain the SQL Statements recieved ??

(btw, I recently shifted from MSSQL to MySQL and everything was working perfect with MSSQL. So there was no problem with the Dynamic SQL statement formation in ASP)

Thanks In Advance Gangadhara Sanya

----- Original Message ----- From: "Erich Dollansky" <ocea@pacific.net.sg> To: "N Gangadhara Sanya" <ngsa@yahoo.co.uk> Cc: <win@lists.mysql.com> Sent: Monday, May 24, 2004 8:29 PM Subject: Re: HELP Dynamic Where Clause from ASP

Hi,

N Gangadhara Sanya wrote:

Hi All,

I have a table in MySQL. I'm trying to access that from an ASP Page like this

dim objConn, resArray,rs set objConn = server.CreateObject("ADODB.Connection") set rs = server.CreateObject("ADODB.Recordset") objconn.ConnectionString =

"Provider=MySQLProv;Location=192.168.10.3;Data Source=zenith;User ID=XXXX;Password=YYYY;Option = " & 1 + 2 + 8 + 32 + 2048 + 163841 & ";"

objConn.Open sSql = "select * from candidate_mis where candidateid >

2030;"

The ';' is to much. It is not needed in the SQL statement used in a program. It is only needed in the command line.

Erich