Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Invalid Column Name
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Astralis
Senior Member

USA
1218 Posts

Posted - 11 January 2005 :  16:36:56  Show Profile  Send Astralis a Yahoo! Message
What's happening?

I got this error:

Microsoft OLE DB Provider for SQL Server error '80040e14' 
Invalid column name 'astralis'. 

/main.asp, line 118 



I know the Ad_Poster column exists.

This is the SQL:

infoSQL = "SELECT TOP 10 ADS.AD_ID as ad_id, ADS.ad_title, ADS.ad_poster, ADS.cat_id AS cat_id, ADS.ad_dated, ADS.ad_price, ADS.ad_state, ADS.ad_price, ADS.ad_zip, ADS.ad_approved, ADS.ad_expired, ADS.ad_description, CATS.CAT_ID, AD_IMAGES.ad_id" _
& " FROM ADS, AD_IMAGES, CATS " _
& " WHERE AD_APPROVED = 1 " _
& " AND ADS.AD_POSTER = " & CC_Username _ <-This is calling the correct variable and the variable exists in the database, in that column
& " AND ADS.AD_ID=AD_IMAGES.AD_ID " _
& " AND CATS.CAT_ID like ADS.CAT_ID " _
& " AND AD_EXPIRED > getDATE() " _
& " AND CATS.CAT_ID=2 " _
& " ORDER BY AD_DATED desc"


I suspect I wrongly joined the tables but I'm not sure. Any advice?
Or does the CC_Username need to be in quotes?

Edited by - Astralis on 11 January 2005 16:38:10

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 11 January 2005 :  16:43:17  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
put single quotes (') around the value of CC_Username

-Stim
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 11 January 2005 :  16:47:43  Show Profile  Send Astralis a Yahoo! Message
How?

Should I do it here:

CC_Username = Session("C_Username")

Or in the SQL?

Either way, how do I correctly add single quotes?
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 11 January 2005 :  16:49:43  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
in the sql

& " AND ADS.AD_POSTER = " & CC_Username _

should be

& " AND ADS.AD_POSTER = '" & CC_Username & "'" _

-Stim
Go to Top of Page

Astralis
Senior Member

USA
1218 Posts

Posted - 11 January 2005 :  16:54:43  Show Profile  Send Astralis a Yahoo! Message
Thanks, once again, Da_Stimulator!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07