Why my databinding is readonly

M

m.a

Hello,

I am trying to learn about data binding in winform. I created a database in
Access and add it to my project. I add a DataGrid to a blank from and set
its data source to a table in my database. VS created three new object in my
form a Dataset a Binding source and a DataAdaptor. When I run the
application, I can change data in my data grid but they are not saved in my
database. I like that when I move from a record, if it is changed, the data
save into the database.

I know that I can save data using code and a save button, but is there any
better way to do this?



Is there any tutorial about how I can create such simple application?



Best regards
 
C

Cor Ligthert[MVP]

Hi,

I don't know what version you are using.
However, you can force to push down the data into the dataset by an
endcurrentedit in version 2003
It should have been endedit, but that did not work well in the versions
before 2005.

Cor
 
M

m.a

Thank you for your reply.
I am using 2008 with .net 3.5.
Where should I use this method?
Regards
 
C

Cor Ligthert[MVP]

Before you do the update of your database.

(From your messages I start to assume that you are not doing that)

Cor
 
M

m.a

Thanks,
I used the endedit method of binding container but still no data is saved
to databse.
I used tableadaptor to save data and it is working, but I want to update my
grid data with the data from database after I update the database and I can
not use the fill method of dataadapter as I am getting the following error:

There is already an open DataReader associated with this Command which must
be closed first

Can you please help me?

Regards
 
C

Cor Ligthert[MVP]

Try to remove all connection opens and connections close around your
dataadatapter, as that is automaticly done by the dataadapter.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top