View Single Post
Old January 20th, 2004, 04:41 PM
Ron Howerton Ron Howerton is offline
Friend of Wrox
Points: 2,876, Level: 22
Points: 2,876, Level: 22 Points: 2,876, Level: 22 Points: 2,876, Level: 22
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Denver, CO, USA.
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default Bound Controls don't update SQL DB

I've got a simple ASP application with a WebForm containing several bound text boxes. The form retrieves the expected record and populates the controls properly. However, the update won't work. Here's the code:

    Private Sub Page_Load(...) Handles MyBase.Load
' code establishing database connection & fill deleted for brevity
        If Not IsPostBack Then
            adpRequest.SelectCommand.CommandText = "Select * from ..."

            adpRequest.Fill(DsRequest, "Requests")

            txtReqDate.DataBind() ' binding properties
            txtReqName.DataBind() ' supplied in
            txtReqPhone.DataBind() ' property window
        End If
    End Sub

    Private Sub btnSubmit_Click(...) Handles btnSubmit.Click
        adpRequest.Update(DsRequest, "Requests")
    End Sub

I've tried this:

Me.BindingContext(DsRequest.Tables("Requests")).En dCurrentEdit()

before the update, but VS says BindingContext is "...not a member of ...webform", which I assume means this is only available to Windows applications and not ASP programs.

So, what's the workaround for ASP?