如何在密码模式下将文本框的值存储在数据库中 [英] how to store the value of textbox in database when it is on password mode
问题描述
textbox的属性enabled = false
你可以在任何字符串变量中取值
string PWD = txtpassword.text
然后存储PWD,否则你可以通过txtpassword.text直接存储值
和往常一样
string password = txtPassword.Text;
将此值传递给插入查询。
Hai
以上两者都有效,只需直接传递密码或在字符串变量中获取密码,并在插入查询中传递该字符串。
如果直接传入数据库尝试
插入UserDetails(密码)值(< span class =code-comment>' + txtpassword.Text.Trim +')
如果你通过字符串传递
昏暗传递as string = txtpassword.Text.Trim
插入UserDetails(密码)值('' + pass +')
我觉得你很困惑如果文本框模式是密码(*****星号),它将存储密码或Stars.Dont工作它只存储正确的密码而不是存储星星。
最好的方法是在去存储密码之前,你需要加密密码并存储在db中,如果你登录你需要解密密码并进行比较,如果正确则只允许登录。
注意在这个插入查询中我只会提到密码,你需要添加用户名或用户ID等
the property of textbox enabled=false
解决方案You can take value in any string variable
string PWD = txtpassword.text
then you store PWD else you can directly store value by txtpassword.text
Same as usual like
string password=txtPassword.Text;
Pass this value into your insert query.
Hai
The above both are work,just pass password directly or get password in string variable and pass that string in insert query.
if directly pass in to databse try
Insert into UserDetails (Password) values ('"+txtpassword.Text.Trim +"')
if u pass via string
Dim pass as string=txtpassword.Text.Trim Insert into UserDetails (Password) values ('"+ pass +"')
I think u confused like if textbox mode is password (***** star symbol),it will store password or Stars.Dont work it store only correct password not store stars.
And best way is before going to store password,u need to encrypt the password and store in db,if u logn u need to decrypt password and compare ,if it correct then only allow login.
Note in this insert query i will mention only password,u need add username or userid ect
这篇关于如何在密码模式下将文本框的值存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!