|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Grabbing external variables into SQL 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
|
||||
|
||||
|
This is ASP by the looks of it so do this
recordSetLING.Open "Create view LING as Keyword.Keyword_ID from Keyword where Keyword.Keywords=" & KW, connectionToDatabase ASP doesnt parse variables inside a string. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Grabbing external variables into SQL statements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|