Home » Open Source » Programming Interfaces » Oracle Lite 10g c# and ODBC (Vista C# .Net 3.5)
Oracle Lite 10g c# and ODBC [message #413589] Thu, 16 July 2009 10:00 Go to next message
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
Re: Oracle Lite 10g c# and ODBC [message #413590 is a reply to message #413589] Thu, 16 July 2009 10:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Don't put the final ";" in the SQL string.

Regards
Michel
Re: Oracle Lite 10g c# and ODBC [message #413593 is a reply to message #413590] Thu, 16 July 2009 10:40 Go to previous message
artvanhecke
Messages: 3
Registered: November 2008
Location: Suitland, Maryland
Junior Member
Thanks Michel,

Sometimes I'm just brain dead.

Art
Previous Topic: Perl script: issue with dates
Next Topic: -2147467259 : Data type is not supported
Goto Forum:
  


Current Time: Tue Dec 06 06:37:52 CST 2016

Total time taken to generate the page: 0.22875 seconds