Help using Oracle Sequence

G

Guest

Hello:

I am running VB.Net to access a oracle 10g table that has a sequence.

This is what I tried:

Dim liID As Integer = 0
Dim lodcCMD As OleDbCommand = New OleDbCommand("SELECT
SUGGEST_SEQ.NextVal FROM DUAL;", odcMain)
odcMain.Open()
liID = CType(lodcCMD.ExecuteScalar(), Integer)

I get the following exception that I really don't understand:

Run-time exception thrown : System.Data.OleDb.OleDbException - One or more
errors occurred during processing of command.
ORA-00911: invalid character

Please help.

venki
 
C

Carlos J. Quintero [VB MVP]

Too much SQL*Plus? ;-)

Yes, that error is so common switching from Oracle SQL*Plus to ODBC / OLEDB
that it would be a good idea for Microsoft to ignore that semicolon in its
ODBC drivers, OLEDB Providers and .NET Data Providers for Oracle.

BTW, why are you using the OLEDB Provider? There are at least 2 free native
..NET data providers for Oracle: the one from Microsoft and the one from
Oracle (ODP.NET) which are a better alternative.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

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