../images/Emo9.gif i have a new problem
Forget about my previous emails as i have a new urgent problem. I am having trouble with my application and don't understand why. When I click the update button the Title field in my database is supposed to get updated according to the value that i entered in txtTtitle. However when i debug the application i see that It sets the txtTitle.text to nothing. the Title field in my db then becomes empty. when i enter values into (cmd.CommandText = "update ads set ad_title='" & ad_title & "' where ad_id=" & ad_id.ToString) instead of ad_title and ad_id then everything works fine. however, that is not the idea. i need to update the fields according to what the user entered. What am i missing? Must i change something in the textbox properties? Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim ad_id As Integer lblID.Text = Request.QueryString("ad_id") Dim con As New ADODB.Connection con.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/database/duclassified.mdb")) Dim rs1 As New ADODB.Recordset rs1.Open("Select * from ads where ad_id=3059", con) Dim ad_title As String Dim ad_price ad_title = rs1("ad_title").Value TxtTitle.Text = ad_title ad_price = rs1("ad_price").Value TxtPrice.Text = ad_price rs1.Close() rs1 = Nothing con.Close() End Sub Function Update() ' If Not Page.IsPostBack Then Dim ad_id As Integer = Me.lblID.Text Dim ad_title As String = Request.QueryString(Me.TxtTitle.Text) Dim cmd As New ADODB.Command Dim mycon As New ADODB.Connection mycon.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/database/duclassified.mdb")) cmd.CommandText = "update ads set ad_title='" & ad_title & "' where ad_id=" & ad_id.ToString cmd.ActiveConnection = mycon cmd.Execute() End Function Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click Update() End Sub End Class