C# Data Binding example with Adapters and DataGridView

sink

A Basic Example of CRUD with DataGridView in VB.Net being one of my more popular posts, I thought I should provide a C# example. I find people on stackoverflow.com continue to struggle with setting up DataAdapters to perform inserts, updates and deletes, and the use of WinForms is still often the platform used by beginners and students.

So here is a small sample application demonstrating how easy it is. There is an embeded SQLite database so you can immediately run the project without worrying about database setup. The code itself is easily translated for your data provider of choice – where you see “SQLite” just replace it with “SQL” or “OleDB”, or whatever you are using:

SQLiteCommand => becomes => SqlCommand

This time I’ll allow the code to speak for itself, get it here on GitHub.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s