永发信息网

帮我改下asp.net里的修改密码代码

答案:1  悬赏:30  手机版
解决时间 2021-06-06 06:16
  • 提问者网友:原来太熟悉了会陌生
  • 2021-06-05 17:40

问题是可以运行可是数据库里的密码没有改变 求高手帮忙修改

Public Class idmodify
Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox

'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub

#End Region

Dim objconn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim comdstr As String
Dim comd As SqlCommand
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pwd1, pwd2, pw As String
pwd1 = Request.Form("TextBox2")
pwd2 = Request.Form("TextBox3")

If TextBox2.Text <> TextBox3.Text Then

Response.Write("<script LANGUAGE='javascript'>alert('两次输入密码不一致');history.go(-1);</script>")

Else

objconn.ConnectionString = "data source =(local);database=xzl;uid=sa;pwd="

comdstr = "updata employeeid set pw = '" & pwd1 & "' where id='" & Session("id") & "' "
comd = New SqlCommand(comdstr, objconn)
comd.Connection.Open()

comd.Connection.Close()
Response.Write("<script LANGUAGE='javascript'>alert('修改成功');history.go(-1);</script>")
Response.End()
End If


End Sub
End Class


最佳答案
  • 五星知识达人网友:神鬼未生
  • 2021-06-05 18:29

comd = New SqlCommand(comdstr, objconn)
comd.Connection.Open()


comd.excuteNonequery()'你的对象没有执行


comd.Connection.Close()

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯