I have not done development work for many years now but I decided to download the new (and free!) Visual Studio 2010 Express C#.

I'm enjoying this, but for the life of me I cannot figure out how to data bind controls.

Here is my setup:

I have a SQL Server CE database with 1 table and that table contains 2 fields.

There is one record in this table and I would like to have a form with 2 text boxes that display the data and allow modifications.

New records cannot be inserted nor can the record be deleted.

I've scoured the web and found many tutorials (like this and this) but I always end up getting lost.

I've also tried clicking on the databinding property and selecting the appropriate field in my table but this doesn't seem to work either.

Is it possible to bind controls to the data from in the gui?

What is the easiest way to bind controls to fields in a SQL Server CE database?

I realize this is probably a very stupid question and I really appreciate your patience as I try to learn this.

Recommended Answers

All 2 Replies

These link might also be helpful. (They relate to Windows Forms application not WPF but the principles are the same.)
MSDN How to:Bind Data to the Windows Forms DataGridView Control (With lots more links to further reading)
Correlation between database, dataset, binding source

Note: Since your DB is SQL CE you will need to use the System.Data.SqlServerCe namespace. This means most of the objects are prefixed SqlCe instead of just Sql. This can become troublesome should you wish to change to a full SQL DB instance later. So think carefully if you really need the CE DB or could you use SqlExpress user instance instead.

Thank you.

The links were very helpful.

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.