sql server 2008 - How to update data faster in sql using c# -
i want update database think code takes lot of time in doing it. takes 20secs or more in updating. possible make faster? if please me.
this code:
for (int = 0; < listview1.items.count; i++) { if (listview1.items[i].subitems[13].text.tostring() == ("active") || listview1.items[i].subitems[13].text.tostring() == ("active")) { (int x = 0; x < listview1.items[i].subitems.count; x++) { string = listview1.items[i].subitems[7].text; timespan time = convert.todatetime(datetime.now.tostring("mmmm dd, yyyy")) - convert.todatetime(a.tostring()); int days = (int)time.totaldays; listview1.items[i].subitems[11].text = days.tostring() + " day(s)"; class1.connecttodb(); class1.sqlstatement = "update tblhd set aging = '" + days.tostring() + " day(s)" + "'"; class1.dbcommand = new sqlcommand(class1.sqlstatement, class1.dbconnection); class1.dbcommand.executereader(); } } }
it seems single update statement:
update tblhd set aging=datediff(day, datefield, getdate())+" day(s)" itemid=...
but it's not idea store user-friendly labels 'day(s)' in database.
Comments
Post a Comment