Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Select Variable

Status
Not open for further replies.

dazedconfused

IS-IT--Management
Apr 26, 2002
3
US
I am designing a web page that selects data form a pervasive database ver 7

When I run this:

Ordsql = "SELECT * FROM equipment WHERE contractnumber LIKE '000000000000016' "

It works, but when I try to use a variable sent form another page:

Ordsql = "SELECT * FROM equipment WHERE contractnumber =" & Request ("var")

I get this:

[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Incompatible types in predicate.

When I try to replace = with LIKE, I get this:

[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: SELECT * FROM equipment WHERE contractnumber LIKE00000000000020<< ??? >>4

I have done this on other pages aith this database and got it to work but I always used =.

Can anyone point me the right direction?
 
try this:

Ordsql = " SELECT * FROM equipment WHERE contractnumber ='" & Request ("var")&"' "

-DNG
 
if you want to use LIKE:

Ordsql = " SELECT * FROM equipment WHERE contractnumber LIKE '%" & Request ("var")&"%' "

-DNG
 
When I use:

LIKE '%" & Request ("var")&"%' "

It takes a couple of minutes and then I get:

The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.

When I use this: LIKE '000000000000016' "
It takes no time at all.

Thanks for the help!


 
1) what is the data type of the field contractnumber in the database ?

2) did you try my first suggestion..

Ordsql = " SELECT * FROM equipment WHERE contractnumber = '"&Request("var")&"' "

-DNG
 
Thanks, That worked great!!!

I used this...

Ordsql = " SELECT * FROM equipment WHERE contractnumber = '"&Request("var")&"' "

I cant thank you enough, Ive been looking at this for days!

Thanks so much!
 
no problem...glad to assist...

always keep a note of this: when the data type of a field in the database is numeric
then use

Ordsql = " SELECT * FROM equipment WHERE contractnumber = "&Request("var")

if the data type is character...then use

Ordsql = " SELECT * FROM equipment WHERE contractnumber = '"&Request("var")&"' "

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top