criceabbado
New Member
I have the following html in an aspx so it is already in a form:-\[code\]<asp:TextBox ID="Name" runat="server" MaxLength="50" Width="175px"></asp:TextBox>\[/code\]I have a button:-\[code\]<asp:Button ID="updateDetails" Text="Update Details" runat="server" OnClick="updateDetails_Click" />\[/code\]In the code behind I have the \[code\]updateDetails_Click\[/code\] proc:-\[code\]protected void updateDetails_Click(object sender, EventArgs e){ utils utils = new utils(); string connectionString = ConfigurationManager.ConnectionStrings[utils.liveTest() + "arenadestinationsConnectionString"].ToString(); string SQL = "UPDATE Users SET " + "Name = @Name, " + "WHERE IdUser = @iDUser"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(SQL, connection); command.Parameters.AddWithValue("@Name", Name.Text); command.Parameters.AddWithValue("@iDUser", Session["loggedIn"].ToString()); try { connection.Open(); command.ExecuteReader(); } catch { } finally { connection.Close(); } }}\[/code\]If I type new text into the Name textbox, when I click on the Update Details button, the Name.Text always shows the original text, never the modified text.What am I doing wrong? I'm converting myself from VB to C# so I will no doubt have a few tricks to learn.