Hi,
There is a textbox which contains some text.
The purpose is to update the text manually into the textbox and send
(update) the updated text to the database.
My problem is that when i click on button2, variable 'txt' contains the
original text and not the manually updated text.
I must forget something but can't find it right now.
Thanks for help
Eric
in aspx file:
<asp:TextBox ID="TextBox1" TextMode="MultiLine"
runat="server"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="update text" />
in code-behind:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
TextBox1.Text = "this is the not updated text"
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim txt As String
txt = TextBox1.Text
Using mConnection As New SqlConnection(param.ConnectionString)
mConnection.Open()
sql = "update mytable set n1 =@txt"
comd = New SqlCommand(sql, mConnection)
comd.Parameters.AddWithValue("@txt", txt)
comd.ExecuteNonQuery()
End Using