i have to two forms one is customers and second is addcustomers
on customers i have a datagridview on customers load function i select records form database
and populate in datagridview.
but on addcustomers form i want when i press add button after saving recored in database it
updates the datagridview id customers form
because all the customer added no shown in datagridview till i reload the form.
but i want get rid of it. plz help me.
Loading
ta muPosted Aug 21, 2013, 11:01 AM
private void button5_Click(object sender, EventArgs e)
{ investor_report re = new investor_report();
re.Show();
DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(@" Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\heaven_prince2009\Desktop\final pr latest\final pr\Database1.mdf;Integrated Security=True;User Instance=True "))
{ if (conn.State == ConnectionState.Closed) conn.Open();
string sql = "select *from add_investor"; SqlCommand cmd = new SqlCommand(sql, conn); SqlDataAdapter dap = new SqlDataAdapter(cmd);
dap.Fill(dt);
if (conn.State == ConnectionState.Open) conn.Close();
conn.Dispose();
re.dtataGridview.dataource=dt; when i try this auto option is data binding. i want to update gridview on form investor_report. while re is its instence
} }
Iftikar HussainPosted Aug 21, 2013, 1:25 AM
http://www.dreamincode.net/forums/topic/238727-insert-update-and-delete-records-in-table-with-datagridview-using-c%23/
Regards,
Iftikar
ta muPosted Aug 21, 2013, 1:22 AM
Iftikar HussainPosted Aug 21, 2013, 12:47 AM
Regards,
Iftikar
ta muPosted Aug 21, 2013, 12:41 AM
i make access modifire public of gridview.
Iftikar HussainPosted Aug 20, 2013, 11:39 PM
You need to call Load grid function after updating your customer on button click.
If possible then share your code.
Regards,
Iftikar
Anurag SarkarPosted Aug 20, 2013, 3:39 PM