none
OLEDB: No value given for one or more required parameters RRS feed

  • Question

  • need help, please

    Tried my best to search solutions for given error "No value given for one or more required parameters." (Error code: -2147217904 (0x80040e10)) for the query below, but unsuccessfully.

     

    Code used in C# which crashes

    Code Snippet

    // create a new SqlConnection object with the appropriate connection string

    glb.sqlConn = new SqlConnection(glb.connectionString);

    //open connection to DB

    OleDbConnection conn = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = '" + MdbFileName + "'");

     

    string sql = "SELECT";

    sql += " TEST_RESULTS.FLV ";

    sql += " FROM EXAM_RESULTS, TEST_RESULTS";

    sql += " WHERE EXAM_RESULTS.TEST1=TEST_RESULTS.INDEX AND EXAM_RESULTS.TEST1 IS NOT NULL";

    sql += " ORDER BY EXAM_RESULTS.ID ";

    OleDbDataReader r = null;

    OleDbCommand comm = new OleDbCommand(sql, conn);

    conn.Open();

    comm.CommandType = System.Data.CommandType.Text;

    r = comm.ExecuteReader();  //CRASHES here

     

          ///do stuff with data

     

    if (r != null) r.Close();

    conn.Close();

     

     

    sql statement itself

    Code Snippet

    SELECT

    TEST_RESULTS.FLV

    FROM

    EXAM_RESULTS, TEST_RESULTS

    WHERE

    EXAM_RESULTS.TEST1=TEST_RESULTS.INDEX AND EXAM_RESULTS.TEST1 IS NOT NULL

    ORDER BY

    EXAM_RESULTS.ID

     

     

    Changing the 2nd line (TEST_RESULTS.FLV) to other available fields in TEST_RESULTS works without problems.

     

    List of other fields in TEST_RESULTS

    Code Snippet
    VC      FEV75 FEV1   FEV3   FEV6   FVC    PEF     MEF75            MEF50            MEF25            MMEF            FIV1    FIVC   PIF      MIF25 MIF50 MIF75 MET    FET     TV       ERV    IRV     IC        FRC            FVL_COUNT VTL_COUNT           FVL     VTL

     

     

    MDB file is located here www.ukbritannia.co.uk/files/000-000-000-001-206.mdb

     

    any help would be  much appreciated.

    thanks a lot

    Dil

     

    Wednesday, April 9, 2008 10:34 AM

Answers

  • Should it be FVL maybe?

     

    Code Snippet

    SELECT R.FVL
    FROM TEST_RESULTS R
    INNER JOIN EXAM_RESULTS E ON (R.INDEX = E.TEST1)
    WHERE E.TEST1 IS NOT NULL

     

    Code Snippet
    SELECT TEST_RESULTS.FVL
    FROM
    EXAM_RESULTS, TEST_RESULTS
    WHERE
    EXAM_RESULTS.TEST1=TEST_RESULTS.INDEX AND EXAM_RESULTS.TEST1 IS NOT NULL
    ORDER BY
    EXAM_RESULTS.ID

     

     

    Thursday, April 17, 2008 6:21 PM

All replies

  • This appears to be an access file, based on the .mdb extension and the oledb connection.  I would however try enclosing the column TEST_RESULTS.FLV in brackets, [TEST_RESULTS.FLV].  The only difference I see is the period which may be causing the problem so this may work.

     

    Best of Luck!!

    Wednesday, April 9, 2008 6:06 PM
  • i even tried

    Code Snippet

    SELECT [FLV] From [TEST_RESULTS]

     

    and

    Code Snippet

    SELECT FLV From TEST_RESULTS

     

     

    and it crashes on EXECUTEREADER command.

     

    not sure what is happening, honestly. Can anybody help please?

    MDB file, including FLV field, opens in Excel, VS.2005 (it is not corrupted)

     

    I have attached very simple example project  ukbritannia.co.uk\files\readMDB.zip

     

    thanks a lot

    Wednesday, April 16, 2008 3:28 PM
  • Should it be FVL maybe?

     

    Code Snippet

    SELECT R.FVL
    FROM TEST_RESULTS R
    INNER JOIN EXAM_RESULTS E ON (R.INDEX = E.TEST1)
    WHERE E.TEST1 IS NOT NULL

     

    Code Snippet
    SELECT TEST_RESULTS.FVL
    FROM
    EXAM_RESULTS, TEST_RESULTS
    WHERE
    EXAM_RESULTS.TEST1=TEST_RESULTS.INDEX AND EXAM_RESULTS.TEST1 IS NOT NULL
    ORDER BY
    EXAM_RESULTS.ID

     

     

    Thursday, April 17, 2008 6:21 PM
  • Thanks Dennis

    I can't belive i did such miserable typo mistake.

     

    Thursday, April 17, 2008 10:08 PM