Hi i am basha,
i am new to VB.NET.
I have a problem, i am able to retrieve data in datagrid throug dataset.
code is
[DG.DataSource=ds]
but if i change any data in grid, it's not changing in database.
please tell me why its not changing and tell me the solution to change data in database using datagrid.

Hi Basha

To change the data in the database itself you have to first see if the dataset has changes and then update the database. The changes you make to the datagrid will be reflected in the dataset, but if you close the form without updating the dataset you will lose the changes.

You can create a commandbuilder which will create the commands to update the database for you, and you have to use the same dadaAdapter you used to fill the dataset.

Hope it helps.

I'm having the same problem.....what error messages are you getting?

You need to use the getchanges method of dataset and pass it to a new dataset then set the new dataset to be the old one then update the dataadapter.
dataset1 is the original dataset.
dataset2 is the one which contains changes.

dataset2 = dataset1.getchanges

you then update the dataadapater

daadapter.update(dataset2)

I'm not sure about the syntax but u get the general idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.