在我的标记上,我正在使用图像按钮来更新数据库上的记录。
这一直有效到现在。
现在,用户收到以下错误:
条件编译已关闭
它说第 1 行字符 33。
我不知道这是什么意思。
标记代码:
<asp:ImageButton ID="saveButton" title="Save" runat="server" OnClick="saveButton_Click" ImageUrl="images/BTN-save.gif"
onmouseout="this.src='images/BTN-save.gif'"
onmouseover="this.src='images/BTN-save.gif'"
子:
Protected Sub saveButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim myConnectionString As [String] = ConfigurationManager.ConnectionStrings("DBConnectionString").ConnectionString
Dim myConnection As New SqlConnection(myConnectionString)
Try
myConnection.Open()
Dim cmd As New SqlCommand("UPDATE tblLogin SET fullname=@fullname,Address=@address,Email=@email, Precinct=@precinct, positionid = @position where " + "username=@username and email=@email", myConnection)
cmd.Parameters.AddWithValue("@fullname", NameTB.Text)
cmd.Parameters.AddWithValue("@address", AddressTB.Text)
cmd.Parameters.AddWithValue("@email", EmailTB.Text)
cmd.Parameters.AddWithValue("@precinct", precinctList.SelectedValue)
cmd.Parameters.AddWithValue("@position", PositionList.SelectedIndex)
cmd.Parameters.AddWithValue("@username", Session("username"))
cmd.Parameters.AddWithValue("@email", Session("UserId"))
Dim rows As Integer = cmd.ExecuteNonQuery()
If rows = 1 Then
Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Information Saved successfully')</SCRIPT>")
Response.Redirect("~/myAccount.aspx")
End If
Catch ex As SqlException
Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('" + ex.Message + "')</SCRIPT>")
Finally
myConnection.Close()
End Try
End Sub
我怀疑它与图像有关,但我不确定。