home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

VBScript SQL Limitations?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2359
Discussions: 200,940, Posts: 2,379,262, Members: 246,303
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,552
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)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,385
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
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is offline   Reply With Quote
Old October 7th, 2004, 12:52 PM     #3 (permalink)
ph34r t3h g04t
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 19,553
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,552
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)
ph34r t3h g04t
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 19,553
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,552
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,552
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,552
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2910)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Wireless Televisions. (8)
California Passes Anti-Flat-HDTV Le.. (43)
Obama the Muslim (14)
Regular Build (5)
Is the PSU I received dead? (11)
windows vista security holes (9)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Print spooler problem (13)
Foreign voltage (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Recent Discussions
Open With ..... Win7 (0)
Regular Build (5)
java code for fibonacci (1)
screen resolution vs monitor size (0)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (35)
windows 7 problem (7)
CPU fan stops spinning randomly (8)
Partition Magic caused HDD problem (3)
Is the PSU I received dead? (11)
Have you switched yet? (85)
Point and Shoot Camera Suggestions. (2)
Modern Warfare 2 freeze (13)
Wireless Televisions. (8)
wireless user (1)
World's largest Monopoly Game using G.. (332)
Ideal cheap graph card for PC-Gaming? (17)
BIOS won't read disk when I try to fl.. (0)
Install XP pro and a Vista laptop ?? (11)
Graphics Card Upgrade Question (1)
favorit (1)
solutions for virtical white lines on.. (1)
Fire in DVD (2)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Wireless Router+Cable Modems and Much.. (0)


All times are GMT -4. The time now is 01:29 PM.
TechIMO Copyright 2009 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