Oracle Lite 10g c# and ODBC [message #413589] |
Thu, 16 July 2009 10:00 |
artvanhecke
Messages: 3 Registered: November 2008 Location: Suitland, Maryland
|
Junior Member |
|
|
I have been trying to use ODBC drivers for Oracle 10g from C# 3.0.
Code follows:
string delSql = "DELETE FROM MAIL_MESSAGES WHERE MESSAGE_DATE < SYSDATE-180;";
string selSql = "Select Message_Type, Message_Date, Message_Survey, Message_Status, Message_Subject, Message_Text FROM Mail_Messages";
string insSql = "Insert into Mail_Messages (Message_Type, Message_Date, Message_Survey, Message_Status, Message_Subject) Values ('O', sysdate-10, 'CPS', 'U', 'Test Mail Message');";
string updSql = "Update Mail_Messages Set Message_Type = 'I';";
try
{
using (OdbcConnection CMdb = new OdbcConnection("DSN=case_management35;uid=******;pwd=************"))
{
CMdb.Open();
OdbcCommand cmd = new OdbcCommand(delSql, CMdb);
numDeleted = cmd.ExecuteNonQuery();
//OdbcCommand SQLCmd = new OdbcCommand(selSql, CMdb);
//OdbcDataReader CMReader = SQLCmd.ExecuteReader();
//CMReader.Close();
CMdb.Close();
}
}
catch (Exception exx)
{
MessageBox.Show(exx.Message + "\n" + exx.GetType().ToString() + "\n" + "Number Deleted = " + numDeleted, "Database Error");
return;
}
SO...whenever I try anything, (delete, insert, update) other than a select command, I get:
ERROR[37000][POL-5228] syntax error
System.Data.Odbc.OdbcException
Any sort of Select Statement works just fine.
Thanks
Art
|
|
|
|
|