I'm working on an app that stores data in a spreadsheet to a Postgresql database. I'm familiar with C# and .Net but not so well with Postgresql. I'm having trouble storing a DateTime value into a TimeStamp column; I keep getting an error message: Failed to convert parameter value from a DateTime to a Byte[]. Any advice would be appreciated.
string query = "INSERT INTO organizer(organizer_name, contact_name, phone, alt_phone, created_date, last_update) " +
"VALUES('@name', '@contactname', '@phone', '@altphone', '@created', '@updated')";
OdbcCommand cmd = new OdbcCommand(query, con);
cmd.Parameters.Add("@name", OdbcType.VarChar);
cmd.Parameters["@name"].Value = org.Name;
cmd.Parameters.Add("@contactname", OdbcType.VarChar);
cmd.Parameters["@contactname"].Value = org.ContactName;
cmd.Parameters.Add("@phone", OdbcType.VarChar);
cmd.Parameters["@phone"].Value = org.Phone;
cmd.Parameters.Add("@altphone", OdbcType.VarChar);
cmd.Parameters["@altphone"].Value = org.AltPhone;
cmd.Parameters.Add("@created", OdbcType.Timestamp).Value = DateTime.Now;
cmd.Parameters.Add("@updated", OdbcType.Timestamp).Value = DateTime.Now;
con.Open();
cmd.ExecuteNonQuery();