Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid character

Status
Not open for further replies.

melusi

IS-IT--Management
Jul 31, 2002
13
ZA
I keep on getting this error with my query on my ASP
"Microsoft VBScript compilation (0x800A0408)
Invalid character"
The query is as follows
SQL="SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName," & _
"FarmAssocMembers.AssocName," & _
"FROM FarmAssocMembers," & _
"GROUP BY FarmAssocMembers.AssocName," & _
&quot;HAVING (((FarmAssocMembers.AssocName) <> &quot;Check&quot;))&quot;

 
SQL=&quot;SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName,&quot; & _
&quot;FarmAssocMembers.AssocName,&quot; & _
&quot;FROM FarmAssocMembers,&quot; & _
&quot;GROUP BY FarmAssocMembers.AssocName,&quot; & _
&quot;HAVING (((FarmAssocMembers.AssocName) <> &quot;Check&quot;))&quot;

I am guessing it doesn't like the &quot;Check&quot;. ASP sees that first quote there and believes that you are finished with your SQL string and then gets confused when there is more stuff following it. Try switching the quotes around the check to single quotes instead. If your db doesn't like string surround in single quotes, you can use double double quotes as an escape character:
SQL=&quot;SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName,&quot; & _
&quot;FarmAssocMembers.AssocName,&quot; & _
&quot;FROM FarmAssocMembers,&quot; & _
&quot;GROUP BY FarmAssocMembers.AssocName,&quot; & _
&quot;HAVING (((FarmAssocMembers.AssocName) <> &quot;&quot;Check&quot;&quot;))&quot;

ASP will resolve this into a string that contains check surrounded by a single pair of double quotes
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Yeah I have tried it and even went to the point of deleting that line with Check.But I still get the same message.
Can we please try something
 
Yeah I have tried it and even went to the point of deleting that line with Check.But I still get the same message.
Can we please try something else
 
Another SQL Issue I see is the over abundance of commas:

SQL=&quot;SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName,&quot; & _
&quot;FarmAssocMembers.AssocName,&quot; & _
&quot;FROM FarmAssocMembers,&quot; & _
&quot;GROUP BY FarmAssocMembers.AssocName,&quot; & _
&quot;HAVING (((FarmAssocMembers.AssocName) <> &quot;&quot;Check&quot;&quot;))&quot;

will give you the SQL String:
SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName,FarmAssocMembers.AssocName,FROM FarmAssocMembers,GROUP BY FarmAssocMembers.AssocName,HAVING (((FarmAssocMembers.AssocName) <> &quot;Check&quot;))

I may be wrong (it happens :p ) but I believe most of these commas are not only unnecessary, but problem-causing

your SQL should come out with spaces between statements, not commas:

SELECT Count(FarmAssocMembers.MemberName) AS CountOfMemberName,FarmAssocMembers.AssocName FROM FarmAssocMembers GROUP BY FarmAssocMembers.AssocName HAVING (((FarmAssocMembers.AssocName) <> &quot;Check&quot;))

or in simpler language:

SELECT table.x as y, table.z FROM table GROUP BY table.z HAVING (table.z <> &quot;value&quot;)

Commas are for lists of attributes, spaces belong between SQL sections (SELECT, FROM, GROUP BY, ORDER BY, etc)


If this is not the problem I would assume it is something nearby in your ASP
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top