ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 22nd, 2003, 03:49 PM
bingbing bingbing is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 bingbing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to bingbing
Grabbing external variables to SQL view statements...

Hi, I'm having a problem with inputting values of external variables into an SQL statement which functions to create a view.
FYI, I'm using Oracle 9i Database Enterprise Edition. The following is my code:

<%
Dim recordSetLING
Dim connectionToDatabase
Dim KW

'In my webpage, I have a combobox named Keyword. Values chosen in combobox will be stored in the external variable KW
KW = " ' " & Request.Form("Keyword") & " ' "


%>
'To check whether KW contains the correct value from combobox
<br>You have chosen
<br>Keyword: <%=KW%>

<%
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout=60
connectionToDatabase.Open "PROVIDER=OraOLEDB.Oracle; Data Source=databasename; User ID=user; PASSWORD=password;"

Set recordSetLING=Server.CreateObject("ADODB.recordSet")
recordSetLING.Open "Create view LING as Keyword.Keyword_ID from Keyword where Keyword.Keywords=KW", connectionToDatabase
.
.
.
.
.
.
The above syntax outputs an error that states KW=invalid identifier. From my understanding, the values in KW was not input into the SQL statement before execution. I am certain that KW contains the correct value before insertion.

The problem is to input the value of KW into the SQL statement
"Create view...". I have referred to several books on SQL and creating views...so far I haven't encountered any syntax that allows the user to create view by grabbing values from external variables and then executing the statement. Your help is greatly appreciated.Thanks!!!

Reply With Quote
  #2  
Old July 22nd, 2003, 04:19 PM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
Code:
recordSetLING.Open "Create view LING as Keyword.Keyword_ID " & _
    "from Keyword " & _
    "where Keyword.Keywords = " & KW, _
    connectionToDatabase

Reply With Quote
  #3  
Old July 22nd, 2003, 05:26 PM
bingbing bingbing is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 6 bingbing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to bingbing
Need further help...

Thanks for the info. Now i've managed to avoid the problem of KW being an invalid identifier. However, referring to my code above,

'To check whether KW contains the correct value from combobox
<br>You have chosen
<br>Keyword: <%=KW%>

This correctly shows me the value of KW that the user has chosen using a combobox in the interface. The problem is that in my results page I only see the check routine above and nothing else. By right it should display something from the database. I've run thru the SQL statements many times manually into the database and it works. Only in ASP it doesn't display it out.

Could it be that the value in KW was not inserted into the SQL statement?

What could be the problem if the value of KW was successfully inserted into the SQL statement?

Thanks for your help.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Grabbing external variables to SQL view statements...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway