scropio gurl

scropio gurl

  • NA
  • 147
  • 99.5k

data continuously inserted in table

Jul 1 2016 8:11 AM
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
  1. if (timediff.TotalMinutes > 5)  
  2. {  
  3. DataClasses1DataContext db = new DataClasses1DataContext();  
  4. var u = db.tbl_urgent_contacts;  
  5. foreach (var a in u)  
  6. {  
  7. tbl_OutBox tb = new tbl_OutBox();  
  8. tb.FromSIM_No = a.SimNo;  
  9. tb.ToSIM_No = a.SimNo;  
  10. tb.ToText = "Check abc";  
  11. tb.Reply = "NA";  
  12. tb.Response = "NA";  
  13. tb.RegNo = "NA";  
  14. tb.Datetd = DateTime.Now;  
  15. tb.FFID = "NA";  
  16. tb.UserId = "You";  
  17. tb.FromText = "Check abc";  
  18. db.tbl_OutBoxes.InsertOnSubmit(tb);  
  19. db.SubmitChanges();  
  20. }  
  21. }  

Answers (1)