Update data problem...help?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Lynn (yeltnab1_at__NOSPAM_hotmail.com)
Date: 08/06/04

  • Next message: Saehoon Cheon: "visual C++ compilation errors"
    Date: Fri, 6 Aug 2004 15:18:25 -0700
    
    

    Hi,

    I have a form that has various text fields in a datalist. When the user gets
    to this page, each textbox is filled with the proper data for the record
    they selected.

    I am having trouble updating a field that is within a datalist. I have an
    asp:textbox with the id="strAddress". This textbox is within an itemtemplate
    in a datalist.

    How do I call the information that the user enters into this field on my
    "update" page?

    Here is my code that is associated with my button:
    >>>>>>>>>>>>>>>>>
    Sub UpdateListing(ByVal sender As System.Object, ByVal e As
    System.EventArgs)
    Dim intMyQS As String
    intMyQS = Request.QueryString("id")

    Dim connListings As OleDbConnection
    Dim strUpdate As String
    Dim cmdUpdate As OleDbCommand

    connListings = New OleDbConnection("provider=microsoft.xxxxxxxxx")
    strUpdate = "UPDATE tblHomeListings SET " & _
    "strAddress=@strAddress WHERE(intHomeID = " & intMyQS & ")"

    cmdUpdate.Parameters.Add("@strAddress", strAddress.Text)
    (>>>>THIS is what is getting flagged in VS.net...the strAddress.text in the
    line above)
    cmdUpdate = New OleDbCommand(strUpdate, connListings)

    connListings.Open()
    cmdUpdate.ExecuteNonQuery()
    connListings.Close()
    End Sub
    >>>>>>>>>>>>>>>>>

    If I use this, and force a manual value for "strAddress" then nothing is
    flagged in VS.net, and it works fine. Like this:
    "strAddress='SOMETHING HERE' WHERE(intHomeID = " & intMyQS & ")"

    Of course, I can't force a manual value.

    Is there a special way to get the value of the textbox when the textbox lies
    within a datalist?

    Am new to VS and to .net.

    Thanks for the help!

    Lynn


  • Next message: Saehoon Cheon: "visual C++ compilation errors"
  • Quantcast