Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 6 of 6

Thread: Filter Orders with Manufacturer Name

  1. #1
    harsha.gus is offline Senior Member
    Join Date
    Mar 2009
    Posts
    301

    Exclamation Filter Orders with Manufacturer Name

    in orders.aspx.cs

    Code:
    private void GenerateReport()
            {
                string sql = "select OrderNumber, OrderDate, IsNew from orders   with (NOLOCK)  where " + WhereClause() + DateClause() + " order by " + OrderByFields;
    can i replace it with

    HTML Code:
                string sql = "select OrderNumber, OrderDate, IsNew from Orders INNER JOIN" +
                          "Orders_ShoppingCart ON Orders.OrderNumber = Orders_ShoppingCart.OrderNumber INNER JOIN" +
                          "Product ON Orders_ShoppingCart.ProductID = Product.ProductID INNER JOIN" +
                          "ProductManufacturer ON Orders_ShoppingCart.ProductID = ProductManufacturer.ProductID INNER JOIN" +
                          "Manufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID"
                             + WhereClause() + DateClause() + " order by " + OrderByFields;
    will this work?
    rbgx
    AspDotNetStorefront ML
    v8.0.1.4

  2. #2
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    Have you tried it?
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  3. #3
    harsha.gus is offline Senior Member
    Join Date
    Mar 2009
    Posts
    301

    Default yes i tried

    Quote Originally Posted by esedirect View Post
    Have you tried it?
    it gives Server Error in '/' Application.
    Code:
    Incorrect syntax near the keyword 'ON'.
    rbgx
    AspDotNetStorefront ML
    v8.0.1.4

  4. #4
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    In SSMS it gives this error:

    Msg 209, Level 16, State 1, Line 1
    Ambiguous column name 'OrderNumber'.

    So you need to fully qualify the first returned column, like this:

    Code:
    select Orders.OrderNumber, OrderDate, IsNew 
    from Orders INNER JOIN
    Orders_ShoppingCart ON Orders.OrderNumber = Orders_ShoppingCart.OrderNumber INNER JOIN
    Product ON Orders_ShoppingCart.ProductID = Product.ProductID INNER JOIN
    ProductManufacturer ON Orders_ShoppingCart.ProductID = ProductManufacturer.ProductID INNER JOIN
    Manufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  5. #5
    harsha.gus is offline Senior Member
    Join Date
    Mar 2009
    Posts
    301

    Exclamation no difference

    it still give me the error

    HTML Code:
                string sql = "select Orders.OrderNumber, OrderDate, IsNew" +
                            "from Orders INNER JOIN" +
                            "Orders_ShoppingCart ON Orders.OrderNumber = Orders_ShoppingCart.OrderNumber INNER JOIN" +
                            "Product ON Orders_ShoppingCart.ProductID = Product.ProductID INNER JOIN" +
                            "ProductManufacturer ON Orders_ShoppingCart.ProductID = ProductManufacturer.ProductID INNER JOIN" +
                            "Manufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID" +
                            WhereClause() + DateClause() + " order by " + OrderByFields;
    gives this error.
    Incorrect syntax near the keyword 'Inner Join'.
    rbgx
    AspDotNetStorefront ML
    v8.0.1.4

  6. #6
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    You've got no spaces between the end of one line of your statement and the beginning of the next line. So your statement is being interpreted like this:

    Code:
                string sql = "select Orders.OrderNumber, OrderDate, IsNewfrom Orders INNER JOINOrders_ShoppingCart ON Orders.OrderNumber = Orders_ShoppingCart.OrderNumber INNER JOINProduct ON Orders_ShoppingCart.ProductID = Product.ProductID INNER JOINProductManufacturer ON Orders_ShoppingCart.ProductID = ProductManufacturer.ProductID INNER JOINManufacturer ON ProductManufacturer.ManufacturerID = Manufacturer.ManufacturerID" +
                            WhereClause() + DateClause() + " order by " + OrderByFields;
    See, no space in IsNewfrom or INNER JOINOrders_ShoppingCart, etc
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!