Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 February 1st, 2005, 02:31 PM
Authorized User
 
Join Date: Jan 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with Invalid column name 'TX'.

I am having an issue with this error. I am loading a page and passing the parameters like this...

ZipcodeSelect.asp?State=TX&City=Houston

but when I try to do my select statement below

<%
strState = request("State")
strCity = request ("City")


    sql = "SELECT Zips.zipcode FROM Zips WHERE State=" & strState & " AND City=" & strCity
    set rs = conn.execute(sql)
%>

I keep getting this error...

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'TX'.

The perameters are dynamic of course based upon info in the database.

my actual table columns are...
zipcode, State, City, lat, and long...

what gives?
 
Old February 1st, 2005, 02:35 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please modify the query as :

    sql = "SELECT Zips.zipcode FROM Zips WHERE State='" & strState & "' AND City='" & strCity & "'"
    set rs = conn.execute(sql)

Om Prakash





Similar Threads
Thread Thread Starter Forum Replies Last Post
alter add puzzle: Invalid column name JL1024 SQL Server 2000 11 June 11th, 2013 04:59 PM
Invalid Column Name error when saving record mmcdonal SQL Server 2000 2 September 5th, 2006 12:42 PM
invalid column length message cronid SQL Server DTS 3 August 5th, 2006 12:49 PM
java.sql.SQLException: Invalid column type Che Guevara Java Databases 1 July 1st, 2005 07:39 AM
Invalid Casting for Null column using ODBC rusli ADO.NET 3 December 17th, 2004 06:32 PM





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