3
Answers

Data continuously inserted in table

scropio gurl

scropio gurl

8y
298
1

I try to send data in table when time exceed over 5 mint data is inserted successfully but data insert multiple times i want to submit data only one time
i.e. only one row insert for 1 number

this is what i try

if (timediff.TotalMinutes > 5)
{
DataClasses1DataContext db = new DataClasses1DataContext();
var u = db.tbl_urgent_contacts;
foreach (var a in u)
{
tbl_OutBox tb = new tbl_OutBox();
tb.FromSIM_No = a.SimNo;
tb.ToSIM_No = a.SimNo;
tb.ToText = "Check abc";
tb.Reply = "NA";
tb.Response = "NA";
tb.RegNo = "NA";
tb.Datetd = DateTime.Now;
tb.FFID = "NA";
tb.UserId = "You";
tb.FromText = "Check abc";
db.tbl_OutBoxes.InsertOnSubmit(tb);
db.SubmitChanges();
}
}

Answers (3)