c# - Filtering by user input getting error message can not get table 0 -
i have wrote code following tutorial posted here http://csharp.net-informations.com/datagridview/csharp-datagridview-filter.htm
however keep getting error "cannot find table 0", have tried several things none have worked
i have posted code in form load , button start process
string connectionstring = "server=localhost;user id=root;database=epas="; string sql = "select * pricing sterling"; sqlconnection con = new sqlconnection(connectionstring); sqldataadapter dataadapter = new sqldataadapter(sql, con); con.open(); dataadapter.fill(ds, "pricing table"); con.close(); datagridview1.datasource = ds.tables[0];
and button
dataview dv; dv = new dataview(ds.tables[0], "id = '21' ", "type desc", dataviewrowstate.currentrows); datagridview1.datasource = dv;
remove spaces name of datatable in
dataadapter.fill(ds, "pricingtable");
Comments
Post a Comment