If you include the "DECLARE" clause at the beginning of the query, it will work:
string query = "DECLARE @MaxID as bigint, "+
" @ListName as Varchar(100), "+
" @ListValue As Varchar(100) " +
" INSERT INTO Lists(ID, ListName, ListValue) " +
" VALUES(@MaxID, @ListName, @ListValue)"
In addition, the correct solution is to change your driver to SQLClient and OracleClient. OleDb is not recommended for use with SQL 2005 and later.
source
share