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

 
well the fact that the when you hard code the value it works says the value is not being passed dynamically and thus throws a database error on the null (undefined) value being added to a SQL statement

We need details!!!!

Some code. what is going on. are you submitting a value via GET? what is the database portion doing.



___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
Well, I agree that I have to start the page at 1 in order to display dynamically other pages from the Date Base.
my code is this:
<%
curr=parseInt(Request.queryString("page"))
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='"+Request.queryString("page")+"'")
......
'crating categories
<%
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()

}%>

.......
'creating categories description
<tr><td align="center" class="des"><% Response.write(ds.fields(0).value)%></td></tr></td></TR>

I hope you understand my problem
thanks in advance
 
the first statement should output this
Code:
SELECT nom,num_cat FROM categories  ORDER BY num_cat

as is your telling the database you want a function called BY(). just get rid of the () and adda space

are declaring the use of jscript?

next. you parseInt the querystring but tehn surround it in quotes making it a string. which is it in the DB? varchar or int

you may just need to get rid of teh quotes
Code:
ds=con.execute("SELECT description, nom FROM categories WHERE num_cat=" + Request.queryString("page"))

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
here is what it says:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'NaN'.

/swt/index.asp, line 14
 
NaN = Null

You're not passing the QueryString. Thats why it works when you hard code the path.

whats going on in the page that contains teh form that is submitted to this script

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
which form? I have no forms in the page.
I am desperate...
 
I created a page called home.asp and it redirect to index.asp?page=1, then when I click on different categories, everything is working.
The thing is why index.asp show always the same error!!!
 
I don't see anything in your code that gives "page" a default value should it be passed as blank. So if you call the index page without a querystring it will throw an error.




Chris.

Indifference will be the downfall of mankind, but who cares?
 
Thanks, but I can't figure out how to fix that. I gave "page" 1 as a value, but the porblem remains the same.
 
you could use
Code:
if Request.queryString("page") = "" then
   curr = 1
else
   curr = parseint(Request.queryString("page"))
end if
or any other method of checking you prefer

you also are using the querystring here
Code:
..WHERE num_cat='"+Request.queryString("page")+"'")

instead of your variable.


Chris.

Indifference will be the downfall of mankind, but who cares?
 
here is the code I wrote:
if(Request.queryString("page") =="" ){
curr = 1}
else{
curr = parseInt(Request.queryString("page"))
}

but the error is the same
my head is getting biggggggger and heavier
 
have you rewritten this bit ?

Code:
..WHERE num_cat='"+Request.queryString("page")+"'")

to

Code:
..WHERE num_cat='"+curr+"'")



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Yes I did.
And the error is :
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'undefined' to a column of data type int.

thank you
 
I think that the problem is not with "page" but with the index.asp itself! Am I right?
 
the problem is you are comparing an string to a integer field


remove the single quotes. (as stated in onpnt's post)

Code:
..WHERE num_cat= "+curr)



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top