home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1840
Discussions: 188,398, Posts: 2,243,595, Members: 232,629
Old October 7th, 2004, 12:37 PM   Digg it!   #1 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,549
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
VBScript SQL Limitations?

I hate this language more and more everyday

That being said, I have two queries that work just fine in MS SQL query analyzer. Then I plug the query into VBScript, it returns nothing. No error is thrown, I am just greeted with an emplty record set.

If I have it print the SQL right before it executes it and plug that into MS Query Analyzer manually I get the desired results. Not in the program though.

SQL statement.
Code:
Select Count(*) From PDA_SMS_Users where Not exists (Select * from Users Where PDA_SMS_Users.username = Users.username AND ((([Access] - ([Access] % 4)) % (4*2))= 4 OR (([Access] - ([Access] % 8)) % (8*2)) = 8))
Relevent code:

Code:
sSQL2 = "Select Count(*) From PDA_SMS_Users where Not exists (Select * from Users Where PDA_SMS_Users.username = Users.username AND ((([Access] - ([Access] % 4)) % (4*2))= 4 OR (([Access] - ([Access] % 8)) % (8*2)) = 8))"
Set oRS = oConn.execute(sSQL2)

iRecordCount = oRS(0)
iRecordCount comes up at 0 in the VBscript program and the correct number in MS Query analyzer

Jkrohn


Last edited by jkrohn : October 7th, 2004 at 12:40 PM.
jkrohn is offline   Reply With Quote
Old October 7th, 2004, 12:51 PM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,026
ah yes I hate that problem as well

Check into the ado connection properties, I can't remember which one it is

adoRecordset.CursorLocation = adUseServer
adoRecordset.CursorType = adOpenStatic

Check the value of those two constants on this site
http://asp.programmershelp.co.uk/adoconstants.php

vass0922 is offline   Reply With Quote
Old October 7th, 2004, 12:52 PM     #3 (permalink)
Kawaru wa yo!
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 16,137
Blog Entries: 7
Nevermind, listen to Vass.

I never got cursorlocation right. I hate SQL.

Whir is online now   Reply With Quote
Old October 7th, 2004, 02:17 PM     #4 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,549
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
God I am getting pissed.

Unfortunately that didn't work Vass.

I converted it all to oRS.open and such, but it still will not return correctly.

Even a simple statement like Select Count(*) From table results in zero :-/

What angers me more is I have the exact same page (and code copied this page from that one) only with a modified SQL statement (one less condition) and it all works perfectly.

I can't even get that page to load ANY data no matter the query.

Jkrohn
jkrohn is offline   Reply With Quote
Old October 7th, 2004, 02:19 PM     #5 (permalink)
Kawaru wa yo!
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 16,137
Blog Entries: 7
Could it be a simple field name misspelling?
Whir is online now   Reply With Quote
Old October 7th, 2004, 02:27 PM     #6 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,549
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
Bah, gimme a minute on this one

Jkrohn
jkrohn is offline   Reply With Quote
Old October 7th, 2004, 02:39 PM     #7 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,549
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
Ok, I wish it was a field misspelling :-/ Remember, these queries work EXACTLY as they are suppossed to in MS Query analyzer.

Have a look for yourself.
One that works
Code:
"Select PDA_SMS_Users.Username, PDA_SMS_Users.pnumber, PDA_SMS_Users.provider, PDA_SMS_Users.LME" & sMetal & "C, PDA_SMS_Users.LME" & sMetal & "WT From PDA_SMS_Users,Users WHERE PDA_SMS_Users.username = Users.username  AND PDA_SMS_Users.LME" & sMetal & " LIKE " & "'%" & sTime & "%' AND SubscriptionEndDate > GETDATE() AND (([Access] - ([Access] % 4)) % (4*2)) = 4"
One that doesn't:
Code:
"Select PDA_SMS_Users.Username, PDA_SMS_Users.pnumber, PDA_SMS_Users.provider, PDA_SMS_Users.LME" & sMetal & "C, PDA_SMS_Users.LME" & sMetal & "WT From PDA_SMS_Users,Users WHERE PDA_SMS_Users.username = Users.username  AND PDA_SMS_Users.LME" & sMetal & " LIKE " & "'%" & sTime & "%' AND SubscriptionEndDate > GETDATE() AND Users.Access = 2"
And for the second query.
One that does work:
Code:
"Select Count(*) From PDA_SMS_Users,Users WHERE PDA_SMS_Users.username = Users.username  AND SubscriptionEndDate > GETDATE() AND PDA_SMS_Users.LME" & sMetal & " LIKE " & "'%" & sTime & "%' AND (([Access] - ([Access] % 4)) % (4*2)) = 4 "
Code:
"Select Count(*) From PDA_SMS_Users,Users where PDA_SMS_Users.Username = Users.username  AND SubscriptionEndDate > GETDATE() AND PDA_SMS_Users.LME" & sMetal & " LIKE " & "'%" & sTime & "%' AND  Users.Access = 2"
The only differences between the two come at the end. If I plug the two that don't work into the page that does, they still don't work. Reverting to the originals causes the page to behave as it should though. Remember that these do EXACTLY what I want in MS Query Analyzer.

Thank god it is lunch, I am going to kill someone. I need a break.
Jkrohn
jkrohn is offline   Reply With Quote
Old October 7th, 2004, 04:11 PM     #8 (permalink)
Real gangstas sip on Yacc
 
jkrohn's Avatar
 
Join Date: Oct 2001
Location: Suckas-ville
Posts: 4,549
Send a message via ICQ to jkrohn Send a message via AIM to jkrohn Send a message via Yahoo to jkrohn
Well it is now working. NO idea what the hell happened.

Thats three hours down the drain.
/me sighs

Jkrohn
jkrohn is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where do I begin? DB Programs inzzane Applications and Operating Systems 7 September 7th, 2003 12:01 AM
DTS Help Needed omalleytrading Webmastering and Programming 7 August 1st, 2003 10:03 AM
who/what uses oracle? LinuxNewbie General Tech Discussion 18 September 18th, 2002 11:06 PM
XML to void out the C language? newbie~wan Webmastering and Programming 31 April 2nd, 2002 11:41 AM

Most Active Discussions
Is It Just Me? (2905)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (6)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
Partition Magic 7.0 (Unallocate.. (17)
For cheap price and good qualit.. (1)
Left 4 Dead Small Freezes (3)
RCA 52Inch HDTV wont turn on (4)
wishin i could edit my aol prof.. (0)
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
building a gaming computer, inp.. (0)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 03:33 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28