Here is the function for saving the list, is there any way for me to save the list in the database and skip the existing one so it will duplicate with the existing one.
private void SaveEventDetailEdit()
{
clsGlobalVariable gv = clsGlobalVariable.GetInstance;
gv.EventIdEdit = txtEventIDEdit.Text;
int counter = 0;
foreach (ListViewItem item in lvwAttendeesEdit.Items)
{
counter++;
gv.ItemNoEdit = counter;
gv.DEmpIdEdit = item.SubItems[1].Text.ToString();
gv.DAttendeesEdit = item.SubItems[2].Text.ToString();
gv.EdeptEdit = item.SubItems[3].Text.ToString();
DataTable dt = new DataTable();
DataSet ds = new DataSet();
DBSQLStatement dbSQLLayer = new DBSQLStatement();
ds = (DataSet)dbSQLLayer.SaveEventDetailEdit();
}
}
Here is my SQL that saves the list
public object SaveEventDetailEdit()
{
DBConnection conn = new DBConnection();
DataSet ds = new DataSet();
StringBuilder sbSQL = new StringBuilder();
clsGlobalVariable gv = clsGlobalVariable.GetInstance;
sbSQL.AppendLine(" INSERT INTO tblEventDetail( EventID, EmpID, Attendees, Dept, ItemNo)");
sbSQL.AppendLine(" VALUES ( '" + gv.EventIdEdit + "', '" + gv.DEmpIdEdit + "', '" + gv.DAttendeesEdit + "', '" + gv.EdeptEdit + "', '" + gv.ItemNoEdit + "')");
ds = (DataSet)conn.SelectData(sbSQL.ToString());
return ds;
}