Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - strSQL Error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

strSQL Error

 Post Reply Post Reply
Author
Pegaso View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 13 February 2003
Location: Switzerland
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pegaso Quote  Post ReplyReply Direct Link To This Post Topic: strSQL Error
    Posted: 15 July 2003 at 4:23pm

I'm working on my new site and I have the following problem:

  • i have the Access file, that contains the tables, tblClassment and tblPoints, etc.
  • now in Access i can relate the 2 tables with a very simple Query, and I can go in the SQL view and copy the following SQL Code:

    SELECT tblClassment.Pilot_ID, Sum(tblPoints.Points) AS SommaDiPoints
    FROM tblPoints RIGHT JOIN tblClassment ON tblPoints.Position = tblClassment.Position_Pilot
    GROUP BY tblClassment.Pilot_ID;
  • in Access this query works very good but when i copy the code in ASP and I edit it, it didn't work and the ASP site give me an "Unspecified error". The ASP Code is the following:

    <%
        Dim rsClassment
        Set rsClassment = Server.CreateObject("ADODB.Recordset")
        strSQL = "SELECT DISTINCT tblClassment.Pilot_ID, Sum(tblPoints.Points) AS SommaDiPoints"
        strSQL = strSQL & " FROM tblPoints RIGHT JOIN tblClassment ON tblPoints.Position = tblClassment.Position_Pilot"
        strSQL = strSQL & "GROUP BY tblClassment.Pilot_ID;"
        rsClassment.Open strSQL, adoCon
         %>

Can anyone help my to solve this problem. Where is the error??

Thank's to all.



Edited by Pegaso
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 15 July 2003 at 5:32pm
maybe the spacing in this line
strSQL = strSQL & "GROUP BY tblClassment.Pilot_ID;"
should be
strSQL = strSQL & " GROUP BY tblClassment.Pilot_ID;"
with a space before GROUP
Back to Top
Pegaso View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 13 February 2003
Location: Switzerland
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pegaso Quote  Post ReplyReply Direct Link To This Post Posted: 15 July 2003 at 10:45pm

No, thats not the problem .

Thanks

Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2003 at 7:17am
Originally posted by Pegaso Pegaso wrote:

No, thats not the problem .

Thanks

Well, yes it is a problem as there is NO space before the keyword in the code you've pasted.

However, you've also added the DISTINCT keyword to your strSQL so its not the same as your initial query anyway.

If it is working in your query, why not just excute the query from ASP, rather than copying the SQL out?

Cheers,
Andrew



Edited by Bunce
There have been many, many posts made throughout the world...
This was one of them.
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 16 July 2003 at 8:07am
didn't even notice the distinct.
place the field following the distinct in parentheses and you may need to the include the sum that you are returning in the group by statement as well.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.