Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 7th, 2003, 08:18 PM
rico rico is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: singapore
Posts: 80 rico User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 48 sec
Reputation Power: 5
Send a message via ICQ to rico
SQL Statement

May i know can i do this?

Dim strSQL as String = "select count(*) as 'count' from Login where UserName = '" & txtLogin.text & "' and Password = '" & txtPassword.text & "' and '" & txtType.text & "' = Type;"

Reply With Quote
  #2  
Old December 7th, 2003, 08:19 PM
rico rico is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: singapore
Posts: 80 rico User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 48 sec
Reputation Power: 5
Send a message via ICQ to rico
there are 2 AND in this statement.. i need to compare 3 Fields in my SQL database... The UserName, The Password and the Access Type...

Reply With Quote
  #3  
Old December 7th, 2003, 08:34 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
should be something like this
Code:
Dim strSQL as String = "SELECT COUNT(*) As 'count' FROM Login where UserName = '" & txtLogin.text & "' AND Password = '" & txtPassword.text & "' AND '" & txtType.text & "' = 'Type'"

Reply With Quote
  #4  
Old December 8th, 2003, 08:13 AM
rico rico is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: singapore
Posts: 80 rico User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 48 sec
Reputation Power: 5
Send a message via ICQ to rico
so do u mean SQL statements allow the use of 2 or more "AND"

Reply With Quote
  #5  
Old December 8th, 2003, 08:16 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
Yes, you can have multiple "AND" statements

Example:
Code:
SELECT *
FROM table1
WHERE field1 = '" & field1 & "' AND
field2 = '" & field2 & "' AND
field3 = '" & field3 & "' AND

etc...

Reply With Quote
  #6  
Old December 9th, 2003, 06:58 AM
rico rico is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: singapore
Posts: 80 rico User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 48 sec
Reputation Power: 5
Send a message via ICQ to rico
thanks alot

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > SQL Statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not 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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway