Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2006, 04:49 PM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default help

Hi,

I wrote a code:

 for hh = 1 to 20
SQL2= "select * from mega where sta_1 <= '"&hh&"' and stp_1 >= '"&hh&"' "
set ts = conn.execute(SQL2)

 do while not ts.eof

 b = b + 1

ts.movenext

The problem is that the code will execute perfect for hh= 1 to 9, but recognises 10, 11, 12... as values less than 2. Hence the over all result will not be perfect.

Can anyone help me force the machine to recognise 10, 11, 12 etc as their true values i.e greater than 9. It seems that the code is interpreting them as a text and not as a number. I tried changing the field value in the Acces DB to "number" from "text" but it will return an error of "data type mismatch in criteria expression"
 
Old February 10th, 2006, 07:56 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

As a string, those numbers are less than 2.

Change your database field to a number and try this:

SQL2 = "select * from mega where sta_1 <= {0} and stp_1 >= {0}"
for hh = 1 to 20
    set ts = conn.execute(string.format(SQL2, hh))
...

-Peter
 
Old February 12th, 2006, 04:30 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Peter,
I tried it and it gave me this error:
Wrong number of arguments or invalid property assignment: 'string'
 on the line set ts = conn.execute(string.format(SQL2, hh))

Regards,
Safiyyu

 
Old February 13th, 2006, 10:42 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What language are you working in? I realize after re-reading the post that your use of "conn.execute" and ".eof" lead me to believe you are not in a .NET language.

-Peter
 
Old February 15th, 2006, 11:43 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Im using ASP with VBscript.

Safiyyu

 
Old February 18th, 2006, 10:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This is an ASP.NET forum. If you have specific ASP or VBScript questions there are forums dedicated to those.

Just remove the single quotes from your original query.

-Peter
 
Old February 20th, 2006, 09:00 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok thnx a lot n bye.










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.