Wrox Programmer Forums
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 15th, 2007, 09:50 AM
Registered User
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default MS Access Query

I am trying to use a MS Access Database in an vb.aspx page.

I have written the following two queries.. but they are giving me errors which i am unable to fix.ANy help in this regard would be highly appreciated .

Query 1: Dim sSQL As String = "UPDATE AuthorTable" & _
                             " SET ID ='" & sID & "',Name = '" & sName & "',BookID ='" & sID & "',Date ='" & sDate & ""

It gives me the error: Syntax error in string in query expression '''.
I understand that there is probably a problem with the way I am ending the query. But I do not understand what would be the correct syntax. Please Help.

Query 2:
Dim sSQL As String = "SELECT COUNT(*)" & _
                              "FROM (" & _
                                "SELECT DISTINCT LastName" & _
                                 " FROM Authors" & _
                              "WHERE Month = '" & sMonth & "' AND ID = '" & sID & "')"

Error: Operator '&' is not defined for string "SELECT COUNT(*)FROM (SELECT DIST" and type 'ListItem'.

Would really appreciate a quick response.


Old July 12th, 2007, 10:11 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

I think you got to use # around the date values in MSAccess. Did you try that?

- Vijay G
Strive for Perfection

Similar Threads
Thread Thread Starter Forum Replies Last Post
ms access query umeshtheone VB Databases Basics 1 June 1st, 2007 10:27 AM
MS Access Query rsm42 ASP.NET 1.0 and 1.1 Basics 2 March 20th, 2007 12:32 PM
I am trying to convert a MS Access Query to a SQL? WebLadyBug SQL Server ASP 3 March 9th, 2007 12:39 PM
MS Access Query sunny76 Access 4 October 18th, 2006 06:54 AM
Ms Access stored query problem turker Classic ASP Databases 0 December 27th, 2005 01:38 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.