Results 1 to 5 of 5

Thread: [Resolved] E_FAIL on cmd.ExecuteReader()????

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    [Resolved] E_FAIL on cmd.ExecuteReader()????

    IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

    Whats that mean?


    objConn.Open()
    Line 22: cmdSelect= New OleDbCommand("SELECT Catalog.CatID, Catalog.Name, Product.ProductID, Product.Name AS ProductName, Product.Price, Product.OfferQty, Product.OfferPrice FROM tbl_catalog AS Catalog, tbl_products AS Product WHERE Catalog.CatID = Product.CategoryID ORDER BY Catalog.Name ASC", objConn)
    Line 23: dtrReader= cmdSelect.ExecuteReader()
    Last edited by nkad; Dec 18th, 2004 at 01:20 AM.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: E_FAIL on cmd.ExecuteReader()????

    SELECT Catalog.CatID, Catalog.Name, Product.ProductID, Product.Name AS ProductName, Product.Price, Product.OfferQty, Product.OfferPrice
    FROM tbl_catalog AS Catalog, tbl_products AS Product
    WHERE Catalog.CatID = Product.CategoryID
    ORDER BY Catalog.Name ASC

    Does this statement work if you use this in the database/ in a test outside of your project. It maybe you need to use a JOIN statement (!LEFT JOIN", "INNER JOIN" or "OUTER JOIN") to link these tables to get the information...

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: E_FAIL on cmd.ExecuteReader()????

    Yes, If i were to open up a new query in Access and use that SQL statement it pulls the data set fine. I dont see why I couldn't do a simple join, (i.e. WHERE TableA.Field1 = TableB.Field1)

    This is my first time messing with ASP.NET btw.



    Here is my code:

    Sub Page_Load

    Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0; DATA Source=\\somepath\db.mdb;"
    Dim objConn As OleDbConnection
    Dim cmdSelect As OleDbCommand
    Dim dtrReader As OleDbDataReader


    objConn = New OleDbConnection(connString)
    cmdSelect = New OleDbCommand("SELECT Catalog.CatID, Catalog.Name AS CatalogName, Product.ProductID, Product.Name AS ProductName, Product.Price, Product.OfferQty, Product.OfferPrice FROM tbl_catalog AS Catalog INNER JOIN tbl_products AS Product ON Catalog.CatID = Product.CategoryID ORDER BY Catalog.Name, Product.Name ASC", objConn)
    objConn.Open()
    dtrReader = cmdSelect.ExecuteReader(CommandBehavior.CloseConnection)
    dgProducts.DataSource = dtrReader
    dgProducts.DataBind()
    dtrReader.Close()
    End Sub

    </script>



    <aspataGrid id="dgProducts" runat="server"
    AutoGenerateColumns="False" CellPadding="4"
    HeaderStyle-BackColor="Black"
    HeaderStyle-ForeColor="White"
    HeaderStyle-HorizontalAlign="Center"
    HeaderStyle-Font-Bold="True">

    <Columns>
    <asp:BoundColumn HeaderText="Cat" DataField="CatalogName" />
    <asp:BoundColumn HeaderText="Product" DataField="ProductName" />
    <asp:BoundColumn HeaderText="Price" DataField="ProductPrice" />
    <asp:BoundColumn HeaderText="Offer Qty" DataField="ProductOfferQty" />
    <asp:BoundColumn HeaderText="Offer Price" DataField="ProductOfferPrice" />
    <asp:BoundColumn HeaderText="Product #" DataField="ProductID" />
    </Columns>
    </aspataGrid>




    EDITD: Ok the code above uses an INNER JOIN but it still doesnt work. Works in Access but not on the website.
    Last edited by nkad; Dec 17th, 2004 at 03:45 PM.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: E_FAIL on cmd.ExecuteReader()????

    Oh and btw.. I can access the database with that SQL statement just fine with ASP, just not with ASP.NET

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: E_FAIL on cmd.ExecuteReader()????

    This thread is RESOVED!!!!

    Microsoft can go shove it. Why can't they make better error reporting?

    Note to self 'Catalog' is a freaking reserved keyword.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width