sql server - Data from textboxes not being saved in SQL database -


i not sure if it's me or there's wrong code. whenever try add new account, being "saved" , shown in datagridview, however, when check under data set or table data, it's not being saved (or updated). using visual studio 2013 , checked microsoft sql version - 2012. did found here , in other sites, uncheck "prevent saving changes require table re-creation"; , changed "copy output directory copy if newer", oh, , changed |datadirectory| path of 2 mdf files.

sorry if i'm asking question asked before. and... here's code (this 1 change password form):

    if txtnewpass.text = txtretyped.text             dim strsql string              try                 dim objadap sqldataadapter                 dim objdt new datatable                  strconn = "data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\fhges.mdf;integrated security=true"                 objconn = new sqlconnection(strconn)                  dim s string = "select * tblaccounts uname collate latin1_general_cs_as='" & frmlogin.txtuname.text & "'and pword collate latin1_general_cs_as='" & frmlogin.txtpassword.text & "';"                 objcomm = new sqlcommand(s, objconn)                 objadap = new sqldataadapter(objcomm)                 objadap.fill(objdt)                  lbluname.text = objdt.rows(0)(4).tostring                  strsql = "update tblaccounts set pword='" & txtretyped.text & "' uname='" & lbluname.text & "'"                  objcomm = new sqlcommand(strsql, objconn)                 objconn.open()                 objcomm.executenonquery()                 objconn.close()                  messagebox.show("saved new password, please re-login", "fhges", messageboxbuttons.ok)                  frmlogin.show()                 frmlogin.txtpassword.clear()                 frmlogin.txtpassword.focus()                 me.hide()              catch ex exception                 msgbox(ex.message)                             if objconn.state = connectionstate.open                     objconn.close()                 end if             end try          else             messagebox.show("password don't match!", "fhges", messageboxbuttons.ok)             txtnewpass.clear()             txtretyped.clear()             txtnewpass.focus()         end if 


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -