Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Interacting with Cookies.  SQL Problems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedInteracting with Cookies. SQL Problems

 Post Reply Post Reply
Author
niugiovanni View Drop Down
Groupie
Groupie


Joined: 20 July 2004
Status: Offline
Points: 43
Direct Link To This Post Topic: Interacting with Cookies. SQL Problems
    Posted: 11 August 2004 at 1:10am

Hey guys,

I'm just getting into ASP and have finished installing WebWiz SQL.  I have everything running correctly, including having the forums generate content on the webpage.  One thing I'd like to do is make it so when a user visits the homepage it checks for their webwiz cookie and, if they've logged in, shows if they have new PM's, or if a certain forum category has updated etc...

After searching the forums I figured out how to use the user_code and match it with the WWF cookie the user holds.  For some reason though when I execute the following code:

Quote

strUserCode = Request.Cookies("WWF")("UID")
Response.Write("UserCode: " & strUserCode)
 
'open database
set connCookieTemp = Server.CreateObject("ADODB.Connection")
cookieSQL = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
connCookieTemp.Open cookieSQL
set rscookietemp = Server.CreateObject("ADODB.Recordset")
'If a cookie exsists on the users system then read in there username from the database
If strUserCode <> "" Then
Response.Write("Cookies!  Yes!")
cookieSQL = "SELECT * FROM tblAuthor WHERE User_Code = "&strUserCode
set rscookietemp=connCookieTemp.execute(cookieSQL)
strShownUsername = rscookietemp("Username")
Response.Write("Found Ya!" & strShownUsername)
Else
Response.Write("No Cookies? Please Log-In")
End If

I get an error telling me "invalid column name" and then the cookie's info.  Anyone know why I'm getting a column error when it should be trying to match the user_code?

Thank you all in advance.



Edited by niugiovanni
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Direct Link To This Post Posted: 14 August 2004 at 8:27am
for the cookieSQL you are better off using

cookieSQL = "SELECT * FROM tblAuthor WHERE tblAuthor.User_Code = '"&strUserCode &"'

if you put them into quotes anything in them are one value .. and prevents errors.

not sure if that will solve your problem ..

ussually invalid collumn name can be  where you have wrong sever verables for example using True and False on an SQL server query where it should be 0 and 1.
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Direct Link To This Post Posted: 14 August 2004 at 8:03pm
Non numeric comparisons should always be enclosed in single quotes as dj air said.
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.