Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > SQL Where <> help with syntax

Reply
Thread Tools

SQL Where <> help with syntax

 
 
iam247@gmail.com
Guest
Posts: n/a
 
      07-30-2005
Hi

I am fairly inexperienced with ASP, SQL and VB Script.

In one of my web pages I am trying to search a table in access which
has a number of integers (GroupID's) (1 to 5 at present) and find those
which do not match another set of GroupID's already contained in a
record set named rsGroupsJ (1 to 4 at present).

I want to find the GroupID's which do not match ie GroupID

I have created the following sql which returns the error:
"Unterminated string constant"

strSQL3 = "SELECT tblGroups.* FROM tblGroups WHERE tblGroups.GroupID <>
(rsGroupsJ("GroupID"))"

The following sql does not create an error message but the WHERE bit
seems to be ignored - it returns all records 1 to 5, it should only
return 5

I am realy poor at creating sql statements, I am never sure where or
why to put " or &

I have looked at a number of tutorials but cannot find examples close
to my requirements.

Any help with this would be appreciated

ColinK

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-31-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi
>
> I am fairly inexperienced with ASP, SQL and VB Script.
>
> In one of my web pages I am trying to search a table in access which
> has a number of integers (GroupID's) (1 to 5 at present) and find
> those which do not match another set of GroupID's already contained
> in a record set named rsGroupsJ (1 to 4 at present).
>
> I want to find the GroupID's which do not match ie GroupID
>
> I have created the following sql which returns the error:
> "Unterminated string constant"
>
> strSQL3 = "SELECT tblGroups.* FROM tblGroups WHERE tblGroups.GroupID
> <> (rsGroupsJ("GroupID"))"


Do
response.write strsql3

to see the esult of this concatenation.


>
> The following sql does not create an error message but the WHERE bit
> seems to be ignored - it returns all records 1 to 5, it should only
> return 5


See above

>
> I am realy poor at creating sql statements, I am never sure where or
> why to put " or &


Forget concatenation. Create your query in Access and verify that it works.
That'st the only way to see if you're doing it correctly.

>
> I have looked at a number of tutorials but cannot find examples close
> to my requirements.
>
> Any help with this would be appreciated
>
> ColinK


All right, you're depending too much on multiple recordsets, but, here's my
take on the rule for delimeters:
http://groups-beta.google.com/group/...UTF-8&oe=UTF-8

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
Syntax bug, in 1.8.5? return not (some expr) <-- syntax error vsreturn (not (some expr)) <-- fine Good Night Moon Ruby 9 07-25-2007 04:51 PM
Help with SQL "INSERT INTO " syntax ewpatton@gmail.com ASP .Net 6 06-25-2007 10:18 AM
[ANN] SqlStatement 1.0.0 - hide the syntax of SQL behind familiarruby syntax Ken Bloom Ruby 3 10-09-2006 06:46 PM
Syntax highligth with textile: Syntax+RedCloth ? gabriele renzi Ruby 2 12-31-2005 02:44 AM



Advertisments