c# - Function is not working -
i trying display recent "oders" order table. if have orders in table, message "no orders get". wrong code?
public static list<orderinfo> getordersbyrecent (int count) { dbcommand comm = genericdataaccess.createcommand (); comm.commandtext = "ordersgetbyrecent"; dbparameter param = comm.createparameter (); param.parametername = "@count"; param.value = count; param.dbtype = dbtype.int32; comm.parameters.add (param); return convertdatatabletoorders (genericdataaccess.executeselectcommand (comm)); } protected void byrecentgo_click(object sender, eventargs e) { try { int recordcount = int32.parse(recentcounttextbox.text); list<orderinfo> orders = commercelibaccess.getordersbyrecent(recordcount); grid.datasource = orders; if (orders.count == 0) { errorlabel.text = "<br />no orders get."; } } catch { errorlabel.text = "<br />couldn't requested orders!"; } { grid.databind(); } }
you 0 orders because
list<orderinfo> orders = commercelibaccess.getordersbyrecent(recordcount);
is returning empty list.
it returning empty list because:
return convertdatatabletoorders (genericdataaccess.executeselectcommand (comm));
is returning empty data-table.
you'll have dig data table figure out why thinks empty.
(maybe because empty??)
Comments
Post a Comment