|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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!!! |
|
#2
|
|||
|
|||
|
Code:
recordSetLING.Open "Create view LING as Keyword.Keyword_ID " & _
"from Keyword " & _
"where Keyword.Keywords = " & KW, _
connectionToDatabase
|
|
#3
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Grabbing external variables to SQL view statements... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|