locked
TableAdapter Sql Wizard Preview Data : Error Msg "No value given for one or more required parameters"

    Question

  • In VC-2005 Express I've created a simple DataAccess Class (DLL) connecting to Access 2003.  The DataSet has two tables (Patient and Rx) and I've used the TableAdapter SQL wizard to create several queries one each table without any problems.

    Now when I've added:
    SELECT RxID, PatientID, RxText, Comment1, Comment2, Commnet3, IV FROM Rx WHERE `PatientID` = ?

    to the RxTableAdapter, it saves the query OK, but on Preview Data (or using the Query in the UI App) I receive the "Error Msg "No value given for one or more required parameters".

    I put in a parameter Value of 1, and such a value does in fact exist in the Table, in the Preview Data dialog.  Also, the queries on the other table Adapter in the same dataset.xsd work as always.  The Patient to Rx table have a one to many relation on the PatientID field.

    The prior Rx tableAdapter queries used to work fine, but the problem now seems isolated to the Rx table alone, as none of it's queries now function, whereas the Patient tableadapter queries are OK as before.

    What am I missing here ?

    Monday, June 23, 2008 7:44 PM

Answers

  • I'm replying to my own post in the event it may help another developer.

    It seems that the simple typo "Commnet3" in the SQL statement:
    SELECT RxID, PatientID, RxText, Comment1, Comment2, Commnet3, IV FROM Rx WHERE (`PatientID` = ?)

    results in the "missing parameter" error message, even though it's not a parameter, but a returned field !

    After I corrected the spelling to Comment3, then all was OK.  But beware one typo in a "Select field" made every Query
    in that same table unusable, each query only returning the cryptic "missing parameter" error message.
    • Marked as answer by Burt2 Monday, June 23, 2008 10:09 PM
    • Marked as answer by Burt2 Monday, June 23, 2008 10:09 PM
    Monday, June 23, 2008 10:08 PM