Datagridview Playing Stubborn. It Just Wouldn't Bind
I have one stubborn data grid view is refusing to display the bound data. i placed a grid view named exhibitgridview and set its datasource to none. then i added a standalone data
Solution 1:
I do believe you need to supply your DataAdapter with the parameters that you are supplying your select statement with. Take a look.
I have given you an example from my code which uses OleDB (I have removed all the open / close connection for ease of reading). They are VERY similar.
SqlCmd = "select * from App_Details WHERE App_Name LIKE @Var";
aCommand = newOleDbCommand(SqlCmd, aConnection);
aCommand.Parameters.AddWithValue("@Var", value);
OleDbDataAdapterdataAdapter=newOleDbDataAdapter(SqlCmd, aConnection);
OleDbCommandBuildercmdBuilder=newOleDbCommandBuilder(dataAdapter);
// Now I do not see this part in your code right before you bind your data
dataAdapter.SelectCommand.Parameters.AddWithValue("@Var", value);
DataTabletable=newDataTable();
dataAdapter.Fill(table);
dgvSearchApp.DataSource = table;
Post a Comment for "Datagridview Playing Stubborn. It Just Wouldn't Bind"