Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005
    Posts
    4

    Question Unanswered: Problem Querying MsysObjects table

    Hi all,

    When i try to query MsysObjects table following error is caught(try-catch).

    Database error: Too few parameters.Expected 2.

    These are the two lines used to run the SQL query in vc++.

    // Build the SQL statement
    SqlString = "SELECT Name FROM MSysObjects where type = 1 AND (Left([Name],4) <> \"Msys\") AND (Left([Name],1) <> \"~\")";
    // Execute the query
    recset.Open(CRecordset::forwardOnly,SqlString,CRec ordset::readOnly);

    I am using CDatabase class.

    Please Help!

    Regards,
    Ankush Mehta

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I think you will have more chance of gettign an answer if you post the question in the C / .NET threads rather than the Access thread, you could also try to see the examples in the help system. The error message tells you that the line that is failing is supplying too few parameters.

    deos the intellisense give any suggestions - i'd guess you are possibly using the wrong recordset type, or wrong sequence of parameters for what you want to achieve

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Dunno about VC++ but...

    Database error: Too few parameters.Expected 2.
    sounds like a DAO error to me. Usually indicates syntax error in your sql (which there clearly is).
    Try:
    Code:
     SqlString = "SELECT Name FROM MSysObjects where type = 1 AND Left([Name],4) <> 'Msys'"
    No need to get rid of squiggly lines as type 1 objects don't have 'em (they indicate a cached query for things like combo boxes).

    Otherwise you could try:
    Code:
     SqlString = "SELECT Name FROM MSysObjects where type = 1 AND [Name] not like 'Msys*"
    If you are using ADO, replace the * with %.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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