Results 1 to 2 of 2

Thread: [RESOLVED] Please Help Update Command

  1. #1

    Thread Starter
    Lively Member mikelynch's Avatar
    Join Date
    May 2006
    Location
    Goombungee Qld
    Posts
    83

    Resolved [RESOLVED] Please Help Update Command

    Please help... I have done everything required to afaik to enable the update.

    I have used stronly typed components from the Form1, I have the ListBox and the TextBoxes set to appropriate Bindings. The ListBox dataSourse is set to BindingsSource1 and the textBoxes are set to the appropriate bindingsource fields which are FirstName and LastName.

    In the BtnClick Event I have
    Code:
            BindingSource1.EndEdit()
            CustomerTableAdapter1.Update(CustomerDataSet1.Customer)
    This should NOT be giving me an UpDate Command Error.

    I have wasted an hour or more but can't see what I have done to cause this!!!!
    Clicking on a name in the listbox updates the TextBoxes through the BindingsSource1 Control. Everything is functional untill I change a textbox and try to Update.
    Help.
    Attached Images Attached Images   

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Please Help Update Command

    That means the the Data Source wizard hasn't generated an UPDATE statement when it created the TableAdapter. That will happen if you tell it not to, if the query joins multiple tables or if the query doesn't return a primary key.

    Does your database table have a primary key? Does your TableAdapter's query return that primary key?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width