Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle ASP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 16th, 2006, 10:05 AM
Registered User
 
Join Date: May 2006
Location: , , .
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>
  #2 (permalink)  
Old July 22nd, 2006, 04:10 PM
Authorized User
 
Join Date: Apr 2006
Location: Edmonton, , Canada.
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]
  #3 (permalink)  
Old August 18th, 2008, 06:52 AM
Registered User
 
Join Date: May 2007
Location: bangalore, karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Remove the semi-colon; It will work.

Mohammed Ayyub
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.