Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 September 13th, 2007, 01:46 AM
Authorized User
Join Date: Aug 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using "." while querying database..asp gives error

I've written following code which while running in SQL Query Analyzer gives no error...but as soon as I try using it in my asp file...it shows me following error--

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near 'M'.

The code that I've written is--

If not(order_string="")then
  strSQL="SELECT * FROM MASTER M,Reference_company R"
  strSQL=strSQL & "WHERE M.CompanyRefKey = R.ReferenceKey"
  strSQL=strSQL & "ORDER BY "& order_string &""
End if

Can anyone help?? Wats the error?? Why is it showing me error??
Old September 13th, 2007, 10:46 AM
Authorized User
Join Date: Sep 2007
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post

I think it is because you need two spaces in your query. On the where and order by lines there was no space.

strSQL="SELECT * FROM MASTER M,Reference_company R"
strSQL=strSQL & " WHERE M.CompanyRefKey = R.ReferenceKey"
strSQL=strSQL & " ORDER BY "& order_string

Old September 17th, 2007, 02:47 AM
Authorized User
Join Date: Aug 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts

thanx...u caught the correct error!! Thanx!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error querying LDAP bala24 General .NET 0 March 7th, 2007 10:08 PM
Querying the NorthWind Database jazzcatone ASP.NET 1.0 and 1.1 Basics 1 March 19th, 2006 04:36 PM
Querying an Access Database from FrontPage 2002 eclipse66 Classic ASP Databases 0 April 7th, 2005 11:31 PM
DataBase Error in ASP sadik Classic ASP Databases 1 March 14th, 2005 08:50 AM
querying date in db through asp wintak Classic ASP Databases 6 June 22nd, 2004 05:53 PM

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