I am writing an application that has a SqlServer database behind it. When the user selects which table they want to see the gridview is shown and a textbox shows up that they can type in and search that specific gridview. Yet whenever I type anything into the textbox the gridview returns no rows, it doesn't seem to matter what I type into the box. I have tried coding it many different ways but no to avail. any suggestions would be greatly appreciated. this is the code that is called when the user types into the textbox to search the gridview.
privatevoidtxtSearchKeyUp(objectsender, KeyEventArgse)
{
con.Open();
SqlCommandsearchCMD = con.CreateCommand();
searchCMD.CommandType =
CommandType.Text;
searchCMD.Parameters.Add(
"Query", SqlDbType.Char).Value = '%'+txtSearch.Text+ '%';
// searchCMD.CommandText = "SELECT * FROM dbo.[Asset Table] WHERE ([Asset ID] = N'N12855')";
searchCMD.CommandText =
"SELECT assetID, assetName, Description, assetStorageLocation, assetStorageSubLocation, assetType,[bookValue(Estimated)] FROM dbo.assetTable WHERE assetID LIKE 'Query'";
searchCMD.ExecuteNonQuery();
DataTablesearchData = newDataTable();
SqlDataAdaptersearchDT = newSqlDataAdapter(searchCMD);
searchDT.Fill(searchData);
dataAssetTable.DataSource = searchDT;
con.Close();
}