public FrmLoadExcelRecords() { InitializeComponent(); //将main表填充到窗体中。 ClsDataBase myClsDataBase=new ClsDataBase (); dataGridView1.DataSource = myClsDataBase.getMainTable(); strTableName = "";//初始化而已 }
private void btnSearch_Click(object sender, EventArgs e) { ClsDataBase myClsDataBase = new ClsDataBase(); if (txtStrSC.Text=="") { MessageBox.Show("您没有输入订单号"); //将main表填充到窗体中。 dataGridView1.DataSource = myClsDataBase.getMainTable(); strTableName = "";//初始化而已 return; } //将main表填充到窗体中。 dataGridView1.DataSource = myClsDataBase.commandSelect("select * from main where [单号]=\"" + txtStrSC.Text+"\";"); }