ODBC Error on Insert

Doherty, Adam adam.doherty at esso.ca
Tue Jun 5 21:54:49 CEST 2018


Hi All:

I'm having some issues using ODBC with C#.
I am trying to insert the contents of a DataTable into Monet using a foreach loop with MonetDB ODBC client under Windows.

This is the error I receive...
System.Data.Odbc.OdbcException (0x80131937): ERROR [42000] [MonetDB][ODBC Driver 11.27.11]syntax error, unexpected ',' in: "execute 5 (timestamp '2018-06-04 21:22:25',8651,'EVENT','','SYSTEM','1810_INFRA_"

This is my loop which is wrapped in a transaction -

foreach (DataRow row in events.Rows)
                    {
                        cmd.CommandText = String.Format("INSERT INTO chronicle.events_{0}_zone_{1} VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", year, zone);
                        cmd.Parameters.AddWithValue("@date_time", row["Date_Time"]);
                        cmd.Parameters.AddWithValue("@fracsec", row["FracSec"]);
                        cmd.Parameters.AddWithValue("@event_type", row["Event_Type"]);

Truncated for brevity.

I'm not sure where the error in my insert statement is because the error message itself appear to be truncated.

Very frustrating as it hangs on the first row.

Adam







More information about the users-list mailing list