R
Richard Morse
Hi! I'm using ODBC to connect to an Oracle database. I want to do
something like the following:
---------
var conn: OdbcConnection = new OdbcConnection("my connect string here");
var sql: String = "update mytable set col1=?, col2=? where keycol=?";
var command: OdbcCommand = new OdbcCommand(sql, conn);
command.Parameters.Add("@col1", OdbcType.Int, 22).Value = 1;
if (some_test) {
command.Parameters.Add("@col2", OdbcType.Date, 7).Value = 'SYSDATE';
} else {
command.Parameters.Add("@col2", OdbcType.Date, 7).Value = null;
}
command.Parameters.Add("@keycol", OdbcType.Int, 22).Value = my_key;
command.ExecuteNonQuery();
--------
My question is, how do I do that second parameter? How can I tell it to
call SYSDATE, or set the value to null? I admit that I haven't tried
this code, because I don't think that the string 'SYSDATE' is a valid
date object. Should it work?
Thanks,
Ricky Morse
something like the following:
---------
var conn: OdbcConnection = new OdbcConnection("my connect string here");
var sql: String = "update mytable set col1=?, col2=? where keycol=?";
var command: OdbcCommand = new OdbcCommand(sql, conn);
command.Parameters.Add("@col1", OdbcType.Int, 22).Value = 1;
if (some_test) {
command.Parameters.Add("@col2", OdbcType.Date, 7).Value = 'SYSDATE';
} else {
command.Parameters.Add("@col2", OdbcType.Date, 7).Value = null;
}
command.Parameters.Add("@keycol", OdbcType.Int, 22).Value = my_key;
command.ExecuteNonQuery();
--------
My question is, how do I do that second parameter? How can I tell it to
call SYSDATE, or set the value to null? I admit that I haven't tried
this code, because I don't think that the string 'SYSDATE' is a valid
date object. Should it work?
Thanks,
Ricky Morse