sql server 2008 - Refresh Front-End on Data Change in Database by Other User in C# -


i using c# front end multiple users, connected sql server 2008. question is: if 1 user changes data using update operation, how can other user see impact of update statement without using select * command or sda.fill?

i have thousands of records in table takes time on refill.

here code using update data.

myglobalvariables.bsinc.endedit(); myglobalvariables.con.open(); myglobalvariables.cmdstring = "update increment set incamount=" + convert.toint32(txtinc.text) + ", editedby='"+myglobalvariables.myuname+"', editedon=sysdatetime() incyear=" + convert.toint16(cmbincyear.text) + " , empcode='" + myglobalvariables.myempcode + "'"; myglobalvariables.cmd = new sqlcommand(myglobalvariables.cmdstring, myglobalvariables.con); myglobalvariables.cmd.executenonquery(); myglobalvariables.con.close(); myglobalvariables.ds.tables["increment"].rows[myglobalvariables.bsinc.position].acceptchanges(); myglobalvariables.myparentform.lblprog.text = "record updated successfully."; 

i have found solution of problem. here code after insert process.

sqldataadapter sdatemp = new sqldataadapter(); datatable dttemp = new datatable(); myglobalvariables.con.open(); sdatemp = new sqldataadapter("select * increment ecode=(select max(ecode) increment) , userid='"+myglobalvariables.myuid+"'", myglobalvariables.con); myglobalvariables.con.close(); sdatemp.fill(dttemp); myglobalvariables.dtemp.merge(dttemp); myglobalvariables.dtemp.acceptchanges(); myglobalvariables.bsemp.movelast(); 

thanks suggestions.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -