Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle ASP
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2006, 10:05 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>
 
Old July 22nd, 2006, 04:10 PM
Authorized User
 
Join Date: Apr 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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]
 
Old August 18th, 2008, 06:52 AM
Registered User
 
Join Date: May 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Remove the semi-colon; It will work.

Mohammed Ayyub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid Character in the given encoding mswin XSLT 3 November 28th, 2008 06:01 AM
% is an invalid character? owoade .NET Web Services 1 August 12th, 2007 12:32 PM
ORA-14100 auxiora_nemesis Oracle 0 April 6th, 2007 04:25 AM
[Oracle][ODBC][Ora][ORA-01013 Corey Access 1 December 15th, 2006 10:29 AM
An invalid character was found in text content crmpicco Excel VBA 2 May 4th, 2005 04:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.