On my markup, I am using image button to update a record on the db.
This has always worked till now.
Now, users get the following error:
Conditional Compilation is turned off
It says line 1 charachter 33.
I have no idea what this means.
Markup code:
<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'"
Sub:
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
I suspect it has to do with the image but I am not sure.