Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-30-2009, 08:28 AM   #1 (permalink)
sblat
Recruit
 
Join Date: Jun 2009
Posts: 3
sblat is on a distinguished road
Language Site Using SQL Database and ASP

I have created a database containing the content for a website that has four languages.

When I change the variable from text to a variable eg from:

SELECT * FROM cjr_con WHERE [Page URL] = 'news.asp' AND [Language] = 'en'

to SELECT * FROM cjr_con WHERE [Page URL] = 'news.asp' AND [Language] = cjr

I get an error stating that cjr does not have a default value, even if I dim the variable a set its value

Dim cjr
cjr = "en"

Ideally what I am trying the achieve is loading the same pages into the asp page but with different languages filtered via [Language] which would be stored into the session variable cjr_lang.

I want to be able to check on every page that there is already a value for the variable cjr_lang and if not make it the default english "en":

Dim cjr
If Session("cjr_lang") ="" then cjr = "en"
else cjr = Session("cjr_lang")
End If
I've placed within an include file that appears on every page

The variable would be loaded within every page via a flag motive that would set the variable cjr_lang to the correct name eg "en", "es", "fr" and then reload the page.

Is this a viable method!

Any suggestions would be greatfuly received
sblat is offline   Reply With Quote
Old 10-21-2009, 11:14 AM   #2 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 264
rdove is on a distinguished road
You can't declare a variable in asp and have it translate into SQL, it doesn't work. You either have to declare a sql variable and pass it into the ADO object or do string concatenation on the variable to form your sql string.
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Tags
asp, sql and all that jazz

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what language should i be learning?! falsepride Lounge 7 05-18-2007 10:47 AM
How to create a Firefox 2.x site search option for your site. sde HTML, XML, Javascript, AJAX 0 02-09-2007 09:34 AM
Could this be done with any language? FunkMaster HTML, XML, Javascript, AJAX 3 04-12-2006 05:52 PM
what language is this? sde All Other Coding Languages 10 05-25-2004 04:57 PM


All times are GMT -8. The time now is 10:16 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting