CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Update database records

    Okay i have set an oledbConnection, my adapters and datasets. Added a datagrid to my form and in the forms load event set up the connection and filled the datagrid.

    OleDbConnection1.ConnectionString = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=dataBase.mdb"

    DataAdapter1.Fill(DataSet11)

    Now how would i update the dataBase if i add new information in the datagrid?

    Thanks

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: Update database records

    One way is to generate the dataAdapter's commands using oleDbCommandBuilder object that builds InsertCommand ,DeleteCommand,Update Command for the dataAdapter and then use the Update Command of dataBase to make changes into dataSource.
    Link

    You can also specify the SelectCommand, InsertCommand ,DeleteCommand,Update Command in code and then use them to update the dataSource after editting in dataTable bound to dataGrid.Post

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