Hi,
I am trying to execute a prepare statement using oledb provider for
DB2. The command.Prepare() statement is giving me an exception
" No error information available: DB_E_NOCOMMAND(0x80040E0C)."
My code is very simple and is working with other oledb provider, like
SQL Server and oracle.
The code is
OleDbConnection rConn = new
OleDbConnection("Provider=IBMDADB2.1;Persist Security Info=False;Data
Source=SAMPLE;Mode=ReadWrite;User id=db2admin;Password=db2admin;");
rConn.Open();
System.Data.OleDb.OleDbCommand command = new
System.Data.OleDb.OleDbCommand(null, rConn);
// Create and prepare an SQL statement.
command.CommandText = "insert into Department
(DEPTNO,DEPTNAME,MGRNO,ADMRDEPT,LOCATION) values (?,?,?,?,?)" ;
command.Parameters.Clear();
System.Data.OleDb.OleDbParameter pp = new
OleDbParameter("@tt",System.Data.OleDb.OleDbType.C har);
pp.Value = "A12";
command.Parameters.Add(pp);
System.Data.OleDb.OleDbParameter pp1 = new
OleDbParameter("@name",System.Data.OleDb.OleDbType .VarChar,29);
pp1.Value = "myFirstDept";
command.Parameters.Add(pp1);
System.Data.OleDb.OleDbParameter pp2 = new
OleDbParameter("@mgr",System.Data.OleDb.OleDbType. Char);
pp2.Value = "ABC";
command.Parameters.Add(pp2);
System.Data.OleDb.OleDbParameter pp3 = new
OleDbParameter("@adm",System.Data.OleDb.OleDbType. Char);
pp3.Value = "aa";
command.Parameters.Add(pp3);
System.Data.OleDb.OleDbParameter pp4 = new
OleDbParameter("@loc",System.Data.OleDb.OleDbType. Char);
pp4.Value ="San";
command.Parameters.Add(pp4);
command.ExecuteNonQuery();
rConn.Close();
I have tried all possible things that I can find on the internet.
Kindly let me know what am I missing...
Any help in this regard will be great.
Thanx,
NS