private String insert(LottoRate p) { String sql = "", chk = ""; if (p.Id.Equals("")) { p.Id = p.getGenID(); } //p.thoName = p.thoName.Replace("''", "'"); ////p.Remark = p.Remark.Replace("''", "'"); //sql = "Insert Into " + lRate.table + " (" + lRate.pkField + "," + lRate.Active + "," + lRate.Amount + "," + // lRate.AmountPer + "," + lRate.monthId + "," + lRate.periodId + "," + // lRate.rowNumber + "," + lRate.thoId + "," + lRate.thoName + "," + lRate.yearId + ") " + // "Values('" + p.Id + "','" + p.Active + "','" + p.Amount + "','" + // p.AmountPer + "','" + p.monthId + "','" + p.periodId + "','" + // p.rowNumber + "','" + p.thoId + "','" + p.thoName + "','" + p.yearId + "')"; try { chk = conn.ExecuteNonQuery(sql); chk = p.Id; } catch (Exception ex) { MessageBox.Show("Error " + ex.ToString(), "insert Rate"); } finally { } return(chk); }