public Product_data ProductWithBrandFromTo(int idtype, int IdBrand, int from, int to) { Product_data ds = new Product_data(); try { //w_product_with_brand 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,state,StateId,UrlImage,SellingPrice,WarrantyMonth,ShortNote,promotion,isSpec FROM v_web_product_quick_view where ProductTypeid=" + idtype.ToString() + " and BrandId=" + IdBrand + ""; sqlselect = sqlselect + " order by SellingPrice,id) as t1 "; sqlselect = sqlselect + " order by SellingPrice desc,id desc) as t2 "; sqlselect = sqlselect + " order by SellingPrice,id"; SqlConnection con = new SqlConnection(dataaccess.configsql.strcon); SqlDataAdapter da = new SqlDataAdapter(sqlselect, con); da.Fill(ds, Product_data._table); con.Close(); } catch (Exception ex) { Console.Write(ex.ToString()); } return ds; }
public Product_data ProductSearchFromTo(string where, int from, int to) { Product_data ds = new Product_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,state,UrlImage,SellingPrice,WarrantyMonth,ShortNote,promotion,Isspec FROM v_web_product_advance_search " + where; sqlselect = sqlselect + " order by SellingPrice,id) as t1 "; sqlselect = sqlselect + " order by SellingPrice desc,id desc) as t2 "; sqlselect = sqlselect + " order by SellingPrice,id"; SqlConnection con = new SqlConnection(dataaccess.configsql.strcon); SqlDataAdapter da = new SqlDataAdapter(sqlselect, con); da.Fill(ds, Product_data._table); con.Close(); } catch (Exception ex) { Console.Write(ex.ToString()); } return ds; }