private void showData()
{
try
{
OracleConnection conn = new OracleConnection(ConnectionString);
conn.Open();
OracleDataAdapter da = new OracleDataAdapter(string.Format("SELECT Inventory_No,CK_no,CK_name,Start_Time,InventoryMans,Insert_Time,"
+ "Other From T_BJ_Inventory Where ProfitOrLoss is null And Inventory_No like '%{0}%' order by Inventory_No", Inventory_No.Text), conn);
DataSet ds = new DataSet();
da.Fill(ds);
bindingSource1.DataSource = ds.Tables[0];
this.bindingNavigator1.BindingSource = bindingSource1;
this.dataGridView1.DataSource = bindingSource1;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
{
try
{
OracleConnection conn = new OracleConnection(ConnectionString);
conn.Open();
OracleDataAdapter da = new OracleDataAdapter(string.Format("SELECT Inventory_No,CK_no,CK_name,Start_Time,InventoryMans,Insert_Time,"
+ "Other From T_BJ_Inventory Where ProfitOrLoss is null And Inventory_No like '%{0}%' order by Inventory_No", Inventory_No.Text), conn);
DataSet ds = new DataSet();
da.Fill(ds);
bindingSource1.DataSource = ds.Tables[0];
this.bindingNavigator1.BindingSource = bindingSource1;
this.dataGridView1.DataSource = bindingSource1;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
conn.Dispose();
conn.Close();
ds.Dispose();
}
附
da.Fill(ds);
dataGridView1.DataSource = ds;
dataGridView1.DataMember = ds.Tables[0].ToString();