Results 1 to 2 of 2

Thread: DataTable Problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    fgh
    Posts
    332

    DataTable Problem

    Hello techz,,,

    I am building a sqltool in which all tables will be listed in a Listbox, on selection of list box item (table).., the data of the table will be loaded to the grid...

    I need to update the grid on click of a save button, i am able to save some of the tables, but some tables are not able to save ...

    I am using SqlcommandBuilder class.

    I have read a document that the tables without primary keys is not able to update from a datatable...

    Please help to clarify ...

    thankzzz
    Last edited by sureshvijayan; Jan 11th, 2008 at 05:44 AM.
    gh

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

    Re: DataTable Problem

    In order to update a record you have to be able to identify it. The purpose of a primary key is to uniquely identify each row in the table. If your table has no primary key the a CommandBuilder will not generate an UPDATE or DELETE statement because it has no way to uniquely identify each row.
    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