C# problem to save data in the table

I need urgent help in the visual studio 2015: I build windows application using C# to build database and I want insert data to the local table. the problem is: when (after run the project) I add record to DataGridView and save it, I see the inserted data in DataGridView, but when I exit all the data lost in the local table (not saved)???

Same problem when I build Access table, I used the following code for it:

private void button1_Click(object sender, EventArgs e)
{
OleDbConnection Con = new OleDbConnection(“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|student.accdb”);
Con.Open();
try
{
OleDbCommand Com = new OleDbCommand(“Insert into student(ID,first_name,last_name) values(@ID,@first_name,@last_name)”, Con);
Com.Parameters.AddWithValue("@ID", textBox1.Text);
Com.Parameters.AddWithValue("@first_name", textBox2.Text);
Com.Parameters.AddWithValue("@last_name", textBox3.Text);

Com.ExecuteNonQuery();
studentBindingSource.EndEdit();
studentTableAdapter.Update(this.studentDataSet.student);
MessageBox.Show(“Registration successfull”);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
studentBindingSource.ResetBindings(false);
}
Con.Close();
}

Did you check the return value from ExecuteNonQuery() to see if it worked?

I’m also not certain you can use named parameters with OLEDB. Check the docs.

Thank you

but How I check the return value from ExecuteNonQuery() ?

also I find same problem when I build local database (data after exit is lost in the table only data saved in the view ???)

>but How I check the return value from ExecuteNonQuery() ?

See the docs : 

public override int ExecuteNonQuery ();

Returns
Int32
The number of rows affected.

If you get a return value of 0, then your insert didn’t happen.

>also I find same problem when I build local database (data after exit is lost in the table only data saved in

>the view ???)

I can’t advise on code I can’t see. Creating a repository, pushing your code, and providing a link to the repository would help me and others provide assistance.