CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    asian
    Posts
    116

    how to update the datasource?

    hi im new in vb.net and i cant save the changes i made in the tables.

    Is there anyone who can help me how to save the changes i made? I read some article about this already and it says use the update method of the adapter. But when i did that it updates only the dataset and when i looked the the table from my SQL server the data is not change.

    Can anyone help me? thanks in advance
    Thanks!!!
    Kristine

  2. #2
    Join Date
    Aug 2003
    Posts
    102

    INSERT, DELETE, UPDATE

    A dataadapter works this way " I think"

    when you update the dataadapter........
    first thing it will do is to check the rowstate of each and every row on your "dataadapter(dataset,"tablename")

    if you made an insert, delete or update on the dataset the rowstate of the affected row changes. let say for insert..... rowstate would be Added, for delete row state would be deleted and for update rowstate would be modified........

    now lets go back to the dataadapter........ Once the dataadapter sees these changes...... The dataadapter fires its UpdateCommand for updates, InsertCommand for Inserts and DeleteCommand for deletion.....

    all you need to do is assign sql statement for these command..... to make you life easier ..... you can use CommandBuilder instead ..... this will generate the sql statements for you under the hood.....

    VISIT THIS LINK:
    http://msdn.microsoft.com/library/de...et05282002.asp



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

Featured