|
|
 |
| Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Oracle ASP section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

May 16th, 2006, 11:05 AM
|
|
Registered User
|
|
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ORA-00911: invalid character
I'm getting this error with my code below. However the error is only there when I have my WHERE statement. Any help would be appreciated.
Code:
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = 0031635500;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
Code:
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = '0031635500';";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
Code:
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = ' + 0031635500 + ';";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
Code:
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var numtest = 0031635500;
var query1 = "SELECT AREA FROM ADDN WHERE PARID = ' + numtest + ';";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
Those are all variations that I had tried and the only one I can do and not get the error is
Code:
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
|

July 22nd, 2006, 05:10 PM
|
|
Authorized User
|
|
Join Date: Apr 2006
Location: Edmonton, , Canada.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I noticed in one case you encase your PARID value in single quotes (i.e. a string/varchar datatype) and in the first instance, you have it as an integer (no single quotes).
Could that possibly be the cause of your problem? (i.e. if PARID is an integer, don't encase it in single quotes, if PARID is supposed to be a varchar/string then encase it in single quotes).
Also, beyond that, maybe I'm just not familiar with what you're doing, but within the single quotes you have + 0031635500 + , as though you are inserting a variable in there. What was the purpose of the single quotes and plus symbols?
Also, further down, you have ' + numtest + '
numtest is a variable in your C# code. What you really want here I believe is:
var query1 = "SELECT AREA FROM ADDN WHERE PARID = " + numtest + ";";
So correct me if I'm wrong, but I think your code should look like this (assuming PARID is of an integer datatype):
[code]
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = 0031635500;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = 0031635500;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN WHERE PARID = 0031635500;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var numtest = 0031635500;
var query1 = "SELECT AREA FROM ADDN WHERE PARID = " + numtest + ";";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
Those are all variations that I had tried and the only one I can do and not get the error is
<% @Language = JScript %>
<html>
<head>
<%
var db=Server.CreateObject("ADODB.Connection");
db.Open("Provider=OraOLEDB.Oracle;Data Source=IAS4;User Id=client;Password=password;");
var query1 = "SELECT AREA FROM ADDN;";
Cust = db.Execute(query1);
%>
</head>
<body>
<%=Cust("AREA")%>
</body>
</html>
[code]
|

August 18th, 2008, 07:52 AM
|
|
Registered User
|
|
Join Date: May 2007
Location: bangalore, karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Remove the semi-colon; It will work.
Mohammed Ayyub
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |