string _strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + OpenFilePathName + ";";
using (OleDbConnection _OleConn = new OleDbConnection(_strConn))
{
_OleConn.Open();
string _StrCmd = "UPDATE " + comboBox1.Text + " SET GOLD='" + txtGold.Text + "' WHERE ID='" + txtID.Text + "'";
OleDbCommand _OleCmd = new OleDbCommand(_StrCmd, _OleConn);
_OleCmd.ExecuteNonQuery();
if (_OleConn.State == ConnectionState.Open)
{
_OleConn.Close();
}
}
C#