Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 20th, 2004, 04:41 PM
Friend of Wrox
Join Date: Jun 2003
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?
Old January 28th, 2004, 03:46 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts

As nobody has yet provided a solution to this problem, I can only conclde there is none and this is just another gaping hole in .NET.

My workaround, for those who stumble upon this later and want to write me to ask me how I got around this glaring oversight on MS's part, I abandoned using MS's plumbing and did it all by hand, just like in the good old days. That seems to be the only way to get anything in .NET to work. Maybe release 1.000001 will work as advertised. ;)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert/Update to sql server DB in a scheduler rajanikrishna ASP.NET 2.0 Professional 3 October 26th, 2007 04:27 AM
Bound Vs Unbound controls Richard_AU ADO.NET 1 January 16th, 2007 01:40 PM
Chapter 15 - Update sql db problem oneflatfoot BOOK: Beginning ASP 3.0 1 November 19th, 2006 06:20 PM
Bound Controls cpanson ADO.NET 0 June 24th, 2006 07:29 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.