c# - Why does only one column are being updated in my table database? -
i updating myaccount 1 column[password] being updated. below code. please thanks.
private string connstr = system.web.configuration.webconfigurationmanager.connectionstrings ["connectionstring"].connectionstring; private sqlconnection conn; private sqlcommand cmd; conn = new sqlconnection(connstr); cmd = new sqlcommand("update adminusers set name=@name, username=@username, address=@address, phone=@phone, email=@email, password=@password adminuserid=@adminuserid", conn); cmd.parameters.addwithvalue("@adminuserid", lbladminmyacctid.text); cmd.parameters.addwithvalue("@name", txtadminmyacctname.text); cmd.parameters.addwithvalue("@username", txtadminmyacctusername.text); cmd.parameters.addwithvalue("@address", txtadminmyacctaddress.text); cmd.parameters.addwithvalue("@phone", txtadminmyacctphone.text); cmd.parameters.addwithvalue("@email", txtadminmyacctemail.text); cmd.parameters.addwithvalue("@password", txtadminmyacctnewpassword.text); conn.open(); if (cmd.executenonquery() == 1) { } conn.close(); here data @ database id name username address phone email usertype branch status password 4 default admin auckland 64 123 45678910 admin@admin.com admin main true admin 6 groomer groomer2 main 0221210801 groomer2@groomer.com groomer glen ines true groomer3 7 groomer groomer1 main 0221210800 groomer1@groomer.com groomer duniden true groomer1
is there wrong in database?
could provide more information table structure? think of upper , lower case of column, os did use database on?
based on experience , in linux should notice upper , lower case affect code, while on windows doesn't (usually code caps)
edit :
shouldn't =
cmd = new sqlcommand("update adminusers set name=@name, username=@username, address=@address, phone=@phone, email=@email, password=@password id=@adminuserid", conn);
i didn't see adminuserid column there
Comments
Post a Comment