Oracle OLE DB -- Error ORA-00911: invalid character

B

Barry Young

I am using the following code to insert a row in an Oracle Database.

strConnection = "Provider=OraOLEDB.Oracle;Data Source=MYDATABASE;User
Id=SYSTEM;Password=******"

Dim strMessage As String

Dim objConnection As New OleDb.OleDbConnection(strConnection)

Dim objCommand As OleDb.OleDbCommand


objConnection.Open()

objCommand = New OleDb.OleDbCommand(strSQL, objConnection)

objCommand.ExecuteNonQuery()

objConnection.Close()



Now the strSQL string inserts a row when I cut and paste it in to PLSQL
(SQL+). But when I execute the above code with the same SQL string, I get
an Invalid Character Error. ORA-00911.



Any Ideas??
 
P

Paul Clement

¤ I am using the following code to insert a row in an Oracle Database.
¤
¤ strConnection = "Provider=OraOLEDB.Oracle;Data Source=MYDATABASE;User
¤ Id=SYSTEM;Password=******"
¤
¤ Dim strMessage As String
¤
¤ Dim objConnection As New OleDb.OleDbConnection(strConnection)
¤
¤ Dim objCommand As OleDb.OleDbCommand
¤
¤
¤ objConnection.Open()
¤
¤ objCommand = New OleDb.OleDbCommand(strSQL, objConnection)
¤
¤ objCommand.ExecuteNonQuery()
¤
¤ objConnection.Close()
¤
¤
¤
¤ Now the strSQL string inserts a row when I cut and paste it in to PLSQL
¤ (SQL+). But when I execute the above code with the same SQL string, I get
¤ an Invalid Character Error. ORA-00911.


Any chance you can post the SQL statement? If I had to take a guess it's probably a single quote
character that is causing the problem.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
B

Barry Young

Paul,

Error: Invalid Character Error. ORA-00911.


Now the strSQL string inserts a row when I cut and paste it in to PLSQL
(SQL+). But when I execute the above code with the same SQL string via
VB.NET, I get
an Invalid Character Error. ORA-00911.


SQL String (Executed via SQL+):

SQL> INSERT INTO MYDATABASE.tblXY9999Patients (PatientID, MedRecNo,
lname, fname, mi, street, city,
state, zip, ssn, dob, sex, Ethnicity, SocioEconFlag,
PatientHistoryFlag, PatientPrevSurgeryFlag, Sy
nergyProdigyFlag, IPC, DateCreated, DateLastModified, Status,
LogDateTime, LogUserID, LogReason) Val
ues (4669, '999999', 'John', 'XYYSS', 'J', '2410 World Dr', 'New World',
'HV', '99999','000-00-0000'
, to_date('7/5/1955','MM-DD-YYYY'), 'Male', 'African-American', 0, 0, 0,
0, 0, to_date('5/7/2002 2:4
5:28 PM','MM-DD-YYYY HH:MI:SSAM'), to_date('8/13/2003 1:50:07
PM','MM-DD-YYYY HH:MI:SSAM'), 'Before
Change', sysdate, 'djamison','');

1 row created.

SQL>


I am using the following code to insert a row in an Oracle Database via
the VB.NET Oracle.OLEDBConnection.

Here is the VB.NET Code:

strConnection = "Provider=OraOLEDB.Oracle;Data Source=MYDATABASE;User
Id=SYSTEM;Password=******"

Dim strMessage As String
Dim objConnection As New OleDb.OleDbConnection(strConnection)
Dim objCommand As OleDb.OleDbCommand


objConnection.Open()
objCommand = New OleDb.OleDbCommand(strSQL, objConnection)
objCommand.ExecuteNonQuery()
objConnection.Close()



Any Ideas?? Is there a different OLEDB or Oracle .NET provider
available?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top