sql server - update on datagridview does not update local db with update statement -
i have login form should updating local db current logged on users. on form_load pulls users db hidden datagridview via tableadapter , refreshes every 5 seconds via timer.
on login disables timer, changes single value on datagridview , runs table adapter.update statement. on completion enables timer again refresh datagridview.
my problem is, @ runtime testing, datagridview visible , can see changes value user, once refreshes, old value. code loginbtn_click , timer1_tick below :
private sub loginbtn_click(sender object, e eventargs) handles loginbtn.click if pwtxt.text = pw if datagridview1.item(4, temppos).value = false timer1.enabled = false loggedinid = tempid datagridview1.item(4, temppos).value = true me.logintableadapter.update(logindataset) menuform.show() menuform.focus() timer1.enabled = true else msgbox(trim(tempid) & " logged in. please contact systems administrator.") end end if else msgbox("invalid password") loggedinid = "" end if end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick try me.logintableadapter.fill(me.logindataset.login) catch ex exception msgbox("failed refresh. error : " & vbcrlf & ex.message) end try end sub
any explanation or resolution appreciated. in advance.
Comments
Post a Comment