Re: Can i add a datagrid view in the form through code

i need some info. i want to add a data grid view through vb.net. and when i enter some data in that it will updated in the access database.

Hi i have created a code by which i am able to add a table to mdb file in run time and then using it to show up the value in datagridview. but now i want to update the changes made in the data gridview to mdb file. how to do it. do i have to read one by one data and then insert in to mdb file or is there any direct method available.

Re: Can i add a datagrid view in the form through code

The basics of this is once the dgv is populated, you can make changes. At this point you are changing the dataset. Now since you are selecting all columns, the changes can be done fairly easy.

Of course you will have to put this somewhere so that it can be processed with each change to the datasource. Something like a save button. You will also need to change the scope of your objects so that they are accessible in any other subroutines.

dim DBcb as new OleDb.OleDb.CommandBuilder(DBda)' again since you selected all columns, this can build the proper statment(ie, update or insert)
DBda.Update(DBds, "RFOSIndividual")

Also, in the future, please start a new topic when the subject of the topic changes. This will help others in your situation find any solutions easier.

Re: Can i add a datagrid view in the form through code

The basics of this is once the dgv is populated, you can make changes. At this point you are changing the dataset. Now since you are selecting all columns, the changes can be done fairly easy.

Of course you will have to put this somewhere so that it can be processed with each change to the datasource. Something like a save button. You will also need to change the scope of your objects so that they are accessible in any other subroutines.

dim DBcb as new OleDb.OleDb.CommandBuilder(DBda)' again since you selected all columns, this can build the proper statment(ie, update or insert)
DBda.Update(DBds, "RFOSIndividual")

Also, in the future, please start a new topic when the subject of the topic changes. This will help others in your situation find any solutions easier.

Sorry for the Wrong Posting, i was in a thought that it will help others what will happen to my query..

BTW i have tried the things asked by you, but it still not updating the value in the database.

here is my code:(For saving the data)

Dim DBdaforNewRFOS As OleDb.OleDbDataAdapter
Dim DBdsforNewRFOs As New DataSet