hai sir/madam
im doing one project in c#.net windows application, in this project i display some data from database in gridview and i want to edit and delete the display data from gridview itself .
for example: (i) customer details data are displayed in grid view from customer detail table
(ii) edit and delete the displayed data from gridview and save into customer detail table
pls anyone help me
thankz in advance

Gowtham RajamanickamPosted Apr 13, 2015, 7:57 AM
Khan Abrar AhmedPosted Aug 6, 2014, 3:37 AM
http://www.codeproject.com/Articles/18165/Using-the-Insert-feature-of-SqlDataSource-with-Gri
http://www.aspdotnet-suresh.com/2011/02/normal-0-false-false-false-en-us-x-none.html
http://aspsnippets.com/Articles/Insert-Update-Edit-Delete-record-in-GridView-using-SqlDataSource-in-ASPNet.aspx
Sivaranjani SundarrajPosted Aug 6, 2014, 12:39 AM
Satyapriya NayakPosted Aug 4, 2014, 8:41 AM
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Update_delete_datagridview
{
public partial class Form1 : Form
{
OleDbDataAdapter oledbda;
OleDbCommandBuilder olcb;
DataTable dataTable;
BindingSource bindingSource;
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
string str;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "SELECT * FROM student";
oledbda = new OleDbDataAdapter(str, con);
olcb = new OleDbCommandBuilder(oledbda);
dataTable = new DataTable();
oledbda.Fill(dataTable);
con.Close();
bindingSource = new BindingSource();
bindingSource.DataSource = dataTable;
dataGridView1.DataSource = bindingSource;
dataGridView1.Columns[0].Visible = false;
}
private void btnaddupdate_Click(object sender, EventArgs e)
{
try
{
oledbda.Update(dataTable);
}
catch (Exception exceptionObj)
{
MessageBox.Show(exceptionObj.Message.ToString());
}
MessageBox.Show("Records updated");
}
private void btndelete_Click(object sender, EventArgs e)
{
try
{
dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index);
oledbda.Update(dataTable);
}
catch (Exception exceptionObj)
{
MessageBox.Show(exceptionObj.Message.ToString());
}
MessageBox.Show("Records Deleted");
}
}
}