System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LEMarshall
    New Member
    • May 2012
    • 2

    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

    I have tried everything I can to get beyond this error which shows below as ‘<<<<< error here. It is trying to fill a dataset from a data adapter. If I change the SELECT statement to just ‘SELECT * FROM xTable’ I get the correct number of records in each table. But anytime I try with a more complex statement I get the error message shown below which indicates System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet. I’ve completely erased all data and entered a new set of test data so I know there is no problem with relationships. Each table has primary key which is foreign key in other table.
    IS there something wrong with the Imports section: Imports System

    Imports System.Data
    Imports System.Data.Ole Db
    Imports System.Data.Sql Client

    Imports System.Drawing
    Imports System.Windows. Forms
    Imports System.Guid

    Imports Infragistics.Wi n
    Imports Infragistics.Wi n.UltraWinToolT ip

    Imports Janus.Windows.G ridEX

    Did I miss an data update for Visual Studio?

    Code:
    Private Function LoadgriPrices() As Boolean
             Try
                gblConn = New OleDbConnection(QponConnStr)
                Dim dagexLoad As New OleDbDataAdapter
                Dim dsgexLoad As New DataSet
                Dim recCount As Integer 'Tracks the number of records in the dataset dsgexLoad
    
                Dim mySelectQuery As String = "SELECT i.ItemsID, c.Category,  s.SubCategory, " _
                    & "i.Maker, i.ItemName, i.Measure, i.Size " _
                    & "FROM (Categories AS c INNER JOIN SubCategory AS s ON c.CategoriesID=s.CategoriesID) " _
                    & "INNER JOIN Items AS i ON s.SubCategoryID=i.SubCategoryID;"
    
                Dim myConnection As New OleDbConnection(QponConnStr)
                Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
                myConnection.Open()
                dagexLoad.SelectCommand = myCommand
                [B]dagexLoad.Fill(dsgexLoad)[/B] ‘<<<<< error here
    
                If Not dsgexLoad.Tables(0).Rows.Count > 0 Then
    Immediate window error message:
    {"IErrorInfo.Ge tDescription failed with E_FAIL(0x800040 05)."}
    System.Data.Ole Db.OleDbExcepti on: {"IErrorInfo.Ge tDescription failed with E_FAIL(0x800040 05)."}
    Data: {System.Collect ions.ListDictio naryInternal}
    HelpLink: Nothing
    InnerException: Nothing
    Message: "IErrorInfo.Get Description failed with E_FAIL(0x800040 05)."
    Source: "System.Dat a"
    StackTrace: " at System.Data.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(OleDbHResult hr) at System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S dbParams, Object& executeResult) at System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult) at System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior, Object& executeResult) at System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior behavior, String method) at System.Data.Ole Db.OleDbCommand .ExecuteReader( CommandBehavior behavior) at System.Data.Ole Db.OleDbCommand .System.Data.ID bCommand.Execut eReader(Command Behavior behavior) at System.Data.Com mon.DbDataAdapt er.FillInternal (DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behav
    ior) at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet) at QPon.Pricing.Lo adgriPrices() in C:\QPon\QPon\QP on\Pricing.vb:l ine 129"
    TargetSite: {System.Reflect ion.RuntimeMeth odInfo}

    Sorry for the length of the post but this has been bugging me for a long time as the same code seems towork perfectly well in a Access 2000 database with VB.Net programming. Any direction as WHAT I seem to be missing would be helped. Happen to send a demo attachement if desired.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Try this, Size is a reserved word in SQL, try changing
    Code:
    i.Size
    to
    Code:
    i.[Size]
    to see if that solves your issue

    Comment

    • LEMarshall
      New Member
      • May 2012
      • 2

      #3
      Thank you had no idea that was the problem. In other istances I have gotten error messages that something was a reserved word, but I guess because it was inside the "SELECT statement" VB.Net did not highlight it. Suprised that Access 2007 didn't flag it. But thanks very much.

      Comment

      Working...