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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

url variables 1

Status
Not open for further replies.

pourlefun

Vendor
May 12, 2004
16
CA
I created a page : index.asp, but when I open it this error is displayed: Microsoft OLE DB Provider for ODBC Drivers error '80040e07' Syntax error converting the varchar value 'undefined' to a column of data type int.
But when I open index.asp?page=1 or page=2... everything works so well and all the information is displayed correctly.
do you have any clue!!
thanks

 
your are going to have to meet me halfway! posting "It's still not working" is no help!

I can't see your code and I don't know your database structure.

the problem remains you are comparing dissimilar types.

you will need to do some basic debugging so you can see the variable types and values at various points in your code. the code posted here is not necessarily the absolute answer to the problem. you will have to adapt it to suit your situation.



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Here is the first part of my code:
<%@ language=JavaScript%>
<!--#INCLUDE FILE="budget.html"-->
<head><link rel="StyleSheet" type="text/css" href="cera.css" >
<title>finition</title><%
budget=parseFloat(Request.cookies("budget"))
%>
</head>
<BODY>
<%

curr=Request.queryString("page")
if(curr=="undefined"){curr=1}
con=Server.createObject("ADODB.Connection")
con.open("transact", "sa", "gouba570")
rs=con.execute("SELECT nom, num_cat FROM categories ORDER BY num_cat")
ds=con.execute("SELECT description, nom FROM categories WHERE num_cat=" +curr)


%>
<table width="100%" align="center"><tr><td rowspan="2" width="10%" >
<a href="index.asp?page="1" class="lier"><img src="photos/finition.jpg" border="0" alt="logo" height="60" width="170" valign="top" align="left"></a></td><td>
<table width="100%" align="right" max-height="10"><form name="search" action="rechercher.asp" >
<td class="prodn" width="15%"><a href="compte.asp" class="lier">Votre compte</a></td>
<td class="prodn" width="10%"><a href="abonner.html" class="lier">S'inscrire</a></td>
<td class="prodn" width="15%"><a href="contact.asp" class="lier">Contactez-nous</a></td>
<td class="prodn" width="40%"><input type="text" name="sercher" size="20" style="height:22px; bgcolor:red;">
<input type="submit" name="recherch" value="Search" style="height:20px; text-align:top;"></td>
</tr></form></table></td></tr><tr><td>
<table align="center" width="90%" >
<%

///////////////////////////Creation of menu categories//////////////////////////////

%>

<tr >
<%
while(!rs.EOF){

if(rs.fields(1).value!=curr){%>
<td class="sous" width="10%"><%} else{%>
<td class="men" width="10%"><%}

Response.write('<a href="index.asp?page='+rs.fields(1).value+'" class="lier">')

Response.write(rs.fields(0).value)

Response.write('</a></td>')
rs.moveNext()

}%>
</tr>



</table></td></tr></table>...........

I don't think that there is a problem with the database because it works when I hard code "page".


Here are the two tables I work with in order to produce index.asp:

categories:
nom (varchar)
num_cat (int) primary key
description (varchar)

porduits:
nom (varchar)primary key
num_cat (foreign key)
poids(real)
dimension (varchar)

 
OHHHHHHHHH YESSSSSSSSSSS I solved the problem.
I got it guys
I replaced :
if(curr=="undefined"){
curr=1}
with this:
if(isNaN(curr)){
curr=1}
and the page is displayed as wished.
Thanks for everyone who helped.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top