CLOB Out parameters in stored procs and .NET OLEDB
Hi all,
I am having trouble calling a stored procedure from ADO.NET using OLEDB 9.2 that has an out parameter that is a CLOB. Here is the procedure definition:
procedure test_clob(xml out clob);
The c# code:
string connStr = "Provider=OraOLEDB.Oracle;Persist Security Info=False;User ID=USER1;PASSWORD=PASSWD1;Data Source=DB1;OLEDB.NET=TRUE;SPPrmsLOB=TRUE";
string xml;
OleDbConnection conn = new OleDbConnection(connStr);
conn.Open();
OleDbCommand cmd = new OleDbCommand();
DataSet ds = new DataSet();
cmd.Connection = conn;
cmd.CommandText = "{ call customer_info.test_clob(?) }";
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add("xml",OleDbType.LongVarChar,10000);
cmd.Parameters["xml"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
xml = cmd.Parameters["xml"].Value.ToString();
MessageBox.Show(xml);
Error Message on cmd.ExecuteNonQuery():
Object reference not set to an instance of an object.
Does anyone know what may be causing this? The code is not much different from ADO 2.5 code and it worked fine then. Any help will be greatly appreciated. Thanks,
John Marklund