0
在我的標記中,我正在使用圖像按鈕更新數據庫上的記錄。ImageButton條件編譯已關閉
這一直工作到現在。
現在,用戶可以得到以下錯誤:
條件編譯關閉
報告說,1個線charachter 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 [email protected],[email protected],[email protected], [email protected], positionid = @position where " + "[email protected] and [email protected]", 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
我懷疑它與圖像做,但我不知道。
聽起來就像源頁面的頁面指令中有衝突的參數。看看這些設置,如果沒有什麼顯而易見的話,請編輯您的帖子以包含它們。 –
@ErikNoren,優秀的捕獲。如上所示,我有兩次'@email'。 不幸的是,Try ... Catch沒有捕捉到那一個。 我不得不將它評論出來......試着抓住它。 現在運作良好。 我很樂意爲您提供信用,以幫助您。 –
我加了一個答案。但這聽起來不像是實際的答案。提供誤導性的錯誤消息! –