ODBC Error on Insert

Adam Doherty dohertywa at gmail.com
Wed Jun 6 06:06:08 CEST 2018


This is a lesson in clearly reading the documentation.

I didn't didn't prepare my statement or clear the parameters before the
next iteration.

Adam

On Tue, Jun 5, 2018, 13:55 Doherty, Adam, <adam.doherty at esso.ca> wrote:

> 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
>
>
>
>
>
> _______________________________________________
> users-list mailing list
> users-list at monetdb.org
> https://www.monetdb.org/mailman/listinfo/users-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/users-list/attachments/20180605/3b9ef3b2/attachment.html>


More information about the users-list mailing list