schwankieog
Programmer
I am attempting to connect to a Oracle database through c# code. for speed reason i want to use parameters. the following works fine for select statements but when i try to pass in parameters in an alter statement I receive the error "ORA-01036 illegal variable name/number" oracle states this problem occurs because the parser cannot match my parameters to parameters in the SQL. well its not hard to see the names are the same. any ways any help would be greatly appreciated. please pay attention to the parameters. the connection is an oracle connection as are the parameters, the non-standard method calls are helpers i have created since the actual program must run on any dbms type. result is a dataset. again this code work perfectly for a select statement. its just bombs on the alter statement. thanks in advance for any help. here is my code:
DataSet result = SelectQuery(tableName, sql);
command.CommandText = "alter trigger :TRIGGER " + enableDisable;
command.Parameters.Add(inst.GetNewParameter("TRIGGER", DbType.String, 255));
command.Prepare();
for (int i = 0; i < result.Tables[tableName].Rows.Count; i++) {
((IDbDataParameter) command.Parameters["TRIGGER"]).Value =
result.Tables[tableName].Rows["TRIGGER_NAME"].ToString();
command.ExecuteNonQuery();
}
DataSet result = SelectQuery(tableName, sql);
command.CommandText = "alter trigger :TRIGGER " + enableDisable;
command.Parameters.Add(inst.GetNewParameter("TRIGGER", DbType.String, 255));
command.Prepare();
for (int i = 0; i < result.Tables[tableName].Rows.Count; i++) {
((IDbDataParameter) command.Parameters["TRIGGER"]).Value =
result.Tables[tableName].Rows["TRIGGER_NAME"].ToString();
command.ExecuteNonQuery();
}