C# 2.0 + MS Access == Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Omer

    C# 2.0 + MS Access == Error

    Hi,
    I am using C# 2.0 along with MS Access database. All my queries are
    working perfectly fine, but one inner join query is ocntinously
    throwing. I ahve tried it both from code and running explicitly throw
    query builder, but to no avail. Query is

    "SELECT * FROM COMPANY_ITEM_PR ICE as CIP
    INNER JOIN ITEM as I ON I.ITEM_ID = CIP.ITEM_ID WHERE CIP.COMPANY_ID =
    1 ORDER BY I.NAME"

    The error its throwing is,

    System.Data.Ole Db.OleDbExcepti on: No value given for one or more
    required parameters.
    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 behavior)
    at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet)

    Can anyone please tell me whats wrong iwth the query.

  • Mark Rae

    #2
    Re: C# 2.0 + MS Access == Error

    "Omer" <omer.mush@gmai l.comwrote in message
    news:1161352120 .868958.102510@ m73g2000cwd.goo glegroups.com.. .
    "SELECT * FROM COMPANY_ITEM_PR ICE as CIP
    INNER JOIN ITEM as I ON I.ITEM_ID = CIP.ITEM_ID WHERE CIP.COMPANY_ID =
    1 ORDER BY I.NAME"
    Can anyone please tell me whats wrong iwth the query.
    It's been absolutely ages since I worked with the Jet database, but I'm
    wondering if ITEM might be a reserved word...

    What happens if you put square brackes round it i.e. ... INNER JOIN [ITEM]
    AS I ...

    Also, if you have a full copy of Access, try building the query in the Query
    designer and then look at the SQL it generates...


    Comment

    • Chris Fulstow

      #3
      Re: C# 2.0 + MS Access == Error

      Check that COMPANY_ID isn't a text field, if it is the wrap the 1 in
      quotes.

      --
      Chris Fulstow
      MCP, MCTS


      Omer wrote:
      Hi,
      I am using C# 2.0 along with MS Access database. All my queries are
      working perfectly fine, but one inner join query is ocntinously
      throwing. I ahve tried it both from code and running explicitly throw
      query builder, but to no avail. Query is
      >
      "SELECT * FROM COMPANY_ITEM_PR ICE as CIP
      INNER JOIN ITEM as I ON I.ITEM_ID = CIP.ITEM_ID WHERE CIP.COMPANY_ID =
      1 ORDER BY I.NAME"
      >
      Can anyone please tell me whats wrong iwth the query.

      Comment

      • Omer

        #4
        Re: C# 2.0 + MS Access == Error

        Mark, ITEM is working fine with all my other queries. Chris, I have
        checked it again, COMPANY_ID is a NUMber :(

        Chris Fulstow wrote:
        Check that COMPANY_ID isn't a text field, if it is the wrap the 1 in
        quotes.
        >
        --
        Chris Fulstow
        MCP, MCTS

        >
        Omer wrote:
        Hi,
        I am using C# 2.0 along with MS Access database. All my queries are
        working perfectly fine, but one inner join query is ocntinously
        throwing. I ahve tried it both from code and running explicitly throw
        query builder, but to no avail. Query is

        "SELECT * FROM COMPANY_ITEM_PR ICE as CIP
        INNER JOIN ITEM as I ON I.ITEM_ID = CIP.ITEM_ID WHERE CIP.COMPANY_ID =
        1 ORDER BY I.NAME"

        Can anyone please tell me whats wrong iwth the query.

        Comment

        Working...