你在构造函数中声明dTable并且adapter一旦构造函数完成就会超出范围.
dTable
adapter
您希望将变量声明移动到主类中,例如:
public partial class Form1 : Form { private DataTable dTable; private OleDbDataAdapter adapter; Public Form1() { ... your setup here ... dTable = new DataTable(); ... etc ... } }