Edit in desktop application with DataGridView

Posted by SAMIR BHOGAYTA on Samir ASP.NET with C# Technology See other posts from Samir ASP.NET with C# Technology or by SAMIR BHOGAYTA
Published on 2011-05-02T20:50:00.000-07:00 Indexed on 2011/06/20 16:37 UTC
Read the original article Hit count: 530

private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
string s = DataGridView.Rows[e.RowIndex].Cells[1].FormattedValue.ToString();
srno = Convert.ToInt16(s);
FormName objFrm = new FormName(s);
objFrm.MdiParent = this.MdiParent;
objFrm.Show();
}
}

//Into the New Form
public FormName(string id)
{
uid = id;
i = Convert.ToInt16(id);
InitializeComponent();
}

//Get Detail As per id
public void GetDetail()
{
string detail = "SELECT fieldname1,fieldname2 FROM TableName where PrimaryKeyField = "+id+"";
DataSet ds = new DataSet();
ds = (DataSet)prm.RetriveData(detail);
}

//RetriveData Function
public object RetriveData(string query)
{
// If you have sql connection use SqlConnection
OleDbConnection con = new OleDbConnection(constr);
OleDbDataAdapter drap = new OleDbDataAdapter(query, con);
con.Open();
DataSet ds = new DataSet();
drap.Fill(ds);
con.Close();
return ds;
}


© Samir ASP.NET with C# Technology or respective owner

Related posts about Edit in desktop application with DataGridView