c#如何从DataRow插入Null值Postgre D.B.

时间:2017-09-20 14:36:18

标签: c# postgresql

我尝试将数据中的数据行插入PostgreSql数据库。 但是,不要插入空值。 因为,我一直在犯错误

请帮帮我,谢谢。

            foreach (DataRow row2 in dt.Rows)
            {
                poscmd.Connection = posconn;
                poscmd.CommandText = "insert into public.CBS_DMA_ICME_SUYU values('" + (row2["SICIL_NO"].ToString()) + "','" + (row2["SOZLESME_ID"].ToString())
                  + "','" + (row2["SOZLESME_NO"].ToString()) + "','" + (row2["ABONE_ID"].ToString()) + "','" + (row2["ABONE_NO"].ToString()) + "',"
                  + (row2["SAYAC_NO"].ToString()) + ",'" + (row2["ISLEM_TARIHI"].ToString()) + "','" + (row2["KAC_GUN_SONRA_OKUNDU"].ToString()) + "',"
                  + (row2["OKUMA_DONEMI"].ToString().Replace(",", ".")) + "," + (row2["TUKETIM"].ToString().Replace(",", ".")) + "," + (row2["TAHAKKUK"].ToString().Replace(",", ".")) + ")";
                poscmd.ExecuteNonQuery();
            }

0 个答案:

没有答案