public Component_data ComponantGroupFromTo(int idtype, int idgroup, int from, int to) { Component_data ds = new Component_data(); try { string sqlselect = ""; int num_Row_Get = to - from; sqlselect = "SELECT * FROM ( "; sqlselect = sqlselect + "SELECT TOP " + num_Row_Get.ToString(); sqlselect = sqlselect + " * FROM( SELECT TOP " + to.ToString() + " Id,Name,Brand,UrlImage,SellingPrice,WarrantyMonth,Note FROM v_web_component_all where ProductTypeId=" + idtype + " and ComponentTypeId=" + idgroup + " and CanSales=1"; sqlselect = sqlselect + " order by SellingPrice asc) as t1 "; sqlselect = sqlselect + " order by SellingPrice desc) as t2 "; sqlselect = sqlselect + " order by SellingPrice asc "; SqlConnection con = new SqlConnection(dataaccess.configsql.strcon); SqlDataAdapter da = new SqlDataAdapter(sqlselect, con); da.Fill(ds, Component_data._table); con.Close(); } catch (Exception ex) { Console.Write(ex.ToString()); } return ds; }
public Component_data ComponentQuickSearchFromTo(string where, int from, int to) { Component_data ds = new Component_data(); try { //w_product_for_quick_search string sqlselect = ""; int num_Row_Get = to - from; sqlselect = "SELECT * FROM ( "; sqlselect = sqlselect + "SELECT TOP " + num_Row_Get.ToString(); sqlselect = sqlselect + " * FROM( SELECT TOP " + to.ToString() + " Id,Name,Brand,UrlImage,SellingPrice,WarrantyMonth,Note FROM v_web_component_all " + where; sqlselect = sqlselect + " order by SellingPrice asc) as t1 "; sqlselect = sqlselect + " order by SellingPrice desc) as t2 "; sqlselect = sqlselect + " order by SellingPrice asc "; SqlConnection con = new SqlConnection(dataaccess.configsql.strcon); SqlDataAdapter da = new SqlDataAdapter(sqlselect, con); da.Fill(ds, Component_data._table); con.Close(); } catch (Exception ex) { Console.Write(ex.ToString()); } return ds; }