I created a form that can add / remove records to an SQL database. When I add a record, I want the form to reload, and the list with all the records now includes the newly added record.
I googled this and saw that a new thread was recommended for updating the form, but the instructions were not clear enough for a beginner like me.
Any help would be appreciated.
Thanks in advance.
Edit: This is a desktop application using C #, not asp.
Some controls are populated with the wizard I ran, and for others I myself encoded the data source.
namespace LomWindows { public partial class Form1 : Form { SqlConnection myConnection; public Form1() { InitializeComponent(); myConnection = new SqlConnection(global::LomWindows.Properties.Settings.Default.esConnectionString); tConnStr.Text = global::LomWindows.Properties.Settings.Default.esConnectionString; try { myConnection.Open(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } private void button1_Click(object sender, EventArgs e) { string sqlComm = "INSERT INTO ES_TOOL ...."; try { myCommand.ExecuteNonQuery(); } catch (Exception exce) { Console.WriteLine(exce.ToString()); } try { myConnection.Close(); } catch (Exception exc) { Console.WriteLine(exc.ToString()); } InitializeComponent(); MessageBox.Show("Tool Added"); this.Invalidate(); } } }
source share