data grids

Aug 21 2006 4:27 PM
I am brand new to C#.net develper.

I have a windows form with a
data grid on it. I am getting the data from an Oracle Database. I am able to display the data from the database on the data grid when a button is clicked. But what I need to do is enter 3 items (company, cons number, and year) into 3 text boxes and then when the button is clicked I only want to pull the data from the database where the company, cons number, and year match what was entered into the text boxes. Any help would be wonderful!!!!

public bool fnGetDataConnection()
{
try
{
con =new OleDbConnection(conString);
dAdapter=new OleDbDataAdapter("select * from forecast_exec_dir", con);
dSet=new DataSet();
//refreshes rows in the DataSet
dAdapter.Fill(dSet,"forecast_exec_dir");
}
catch(Exception ex)
{
MessageBox.Show("Error : "+ex.Message);
//connectection failed
return false;
} //try-catch
//connection ok!
return true;
}






private void btFind_Click(object sender,
System.EventArgs e)
{
if (this.fnGetDataConnection())
{
this.dataGrid1.ReadOnly=true;
{
this.dataGrid1.DataSource=dSet.Tables["forecast_exec_dir"];

fnGetDataBindingForTextBoxes();
fnSetCurrencyManager();
fnDisplayRecordNumbers();
}
}
else
{
MessageBox.Show("Connection failed...");
Application.Exit();
}
}