Hi all
I have a datagrid filled with data from Oracle database, I have a textbox and a button search and on the textbox a person/user can enter the Title of the book he/she wana search the the results should be displayed in the datagrid
here is the code on btnSearch
using (OracleConnection conn = new OracleConnection(stringConn))
{
string sql = "select BookID, ISBN, Title, PublishedDate, Edition, Publisher, DepartmentName from Books where Title like '%Title%'";
OracleDataAdapter adap = new OracleDataAdapter(sql, conn);
adap.SelectCommand.Parameters.Add("Title", OracleType.VarChar).Equals(txtSearch.Text);
adap.SelectCommand.Connection.Open();
adap.Fill(dt);
}
DataGrid1.DataSource = dt;
DataGrid1.DataMember = "Books";
DataGrid1.DataBind();
}
but now when I click btnSearch the datagrid which is filled with all the data from the book table just got cleared, instead of desplaying all the books with the title entered in the textbox, please tell me what Im doing wrong
Thanks in advance