I've written a short tutorial how to get started writing sql database applications with C#. The totorial is in PDF format so that you can download it and read at your leasure. It assumes you are using MS-Windows and Visual Studio 2012. If you are using an earlier version of VS then screenshots may be slightly different that those shown in the tutorial. I also assume you already know C# language and can read the code/understand the code. Below is the code. I posted it here without comment because it's explained in the tutorial. The same code is in the tutorial but MS-Word 2010 only inserted a screen shot of it, making it somewhat difficult to read.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MyDVDCollection1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dvd_collectionDataSet.movies' table. You can move, or remove it, as needed.
// this.moviesTableAdapter.Fill(this.dvd_collectionDataSet.movies);
}
private void btnSave_Click(object sender, EventArgs e)
{
this.moviesBindingSource.EndEdit();
this.moviesTableAdapter.Update(this.dvd_collectionDataSet.movies);
}
private void btnRefresh_Click(object sender, EventArgs e)
{
this.moviesTableAdapter.Fill(this.dvd_collectionDataSet.movies);
}
private void btnClear_Click(object sender, EventArgs e)
{
// Remove all selected rows from the Grid
Int32 selectedRowCount =
dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected);
if (selectedRowCount > 0)
{
for (int i = 0; i < selectedRowCount; i++)
{
dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[i].Index);
}
}
}
}
}