data continuously inserted in table


i try send data in table when time exceed on 5 mint data inserted data insert multiple times want submit data 1 time 
i.e. 1 row insert 1 number

try

if (timediff.totalminutes > 5)
{
dataclasses1datacontext db = new dataclasses1datacontext();
var u = db.tbl_urgent_contacts;
foreach (var 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();

}

maybe exclude existing entries this:

   var u = db.tbl_urgent_contacts.where( … );

the “…” condition depends on details of tables , include ‘!db.tbl_outboxes.contains(…)’ expression, etc.

another solution remove processed entries tbl_urgent_contacts if no more needed, or add additional column (bit, boolean), called processed example. have:

  var u = db.tbl_urgent_contacts.where( c => ! c.processed );
  foreach (var in u)
  {
    a.processed = true;
    . . .
  }



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user