Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2006, 04:49 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
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"
  #2 (permalink)  
Old February 10th, 2006, 07:56 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #3 (permalink)  
Old February 12th, 2006, 04:30 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
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

  #4 (permalink)  
Old February 13th, 2006, 10:42 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #5 (permalink)  
Old February 15th, 2006, 11:43 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Im using ASP with VBscript.

Safiyyu

  #6 (permalink)  
Old February 18th, 2006, 10:13 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #7 (permalink)  
Old February 20th, 2006, 09:00 AM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok thnx a lot n bye.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 12:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.