ExecuteNonQuery: CommandText 属性尚未初始化。怎样进行初始化呢?部分代码如下,期待您的回答。
ProtectedSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButton1...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim CommandText As New SqlString
conn.ConnectionString = "Data Source=localhost;Initial Catalog=学生选课系统;Integrated Security=SSPI;Packet Size=4096;User ID=ab;Password=''"
conn.Open()
cmd.Connection = conn
If pwd1.Text = Session("pwda") Then
If pwd2.Text = pwd3.Text Then
cmd.CommandText = "UPDATE AdministorInfo SET AdministorPwd='" & pwd2.Text + "' where AdministorName='" & Session("namea") + "'"
Label1.Text = "修改成功"
Else
Label1.Text = "密码不一致"
End If
Else
Label1.Text = "旧密码不正确"
End If
cmd.ExecuteNonQuery()
conn.Close()
End Sub 展开
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim CommandText As New SqlString
conn.ConnectionString = "Data Source=localhost;Initial Catalog=学生选课系统;Integrated Security=SSPI;Packet Size=4096;User ID=ab;Password=''"
conn.Open()
cmd.Connection = conn
If pwd1.Text = Session("pwda") Then
If pwd2.Text = pwd3.Text Then
cmd.CommandText = "UPDATE AdministorInfo SET AdministorPwd='" & pwd2.Text + "' where AdministorName='" & Session("namea") + "'"
Label1.Text = "修改成功"
Else
Label1.Text = "密码不一致"
End If
Else
Label1.Text = "旧密码不正确"
End If
cmd.ExecuteNonQuery()
conn.Close()
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询