locked
ERROR [HY104][ODBC Microsoft Access Driver] Invalid Precision Value RRS feed

  • Question

  • User299722751 posted

    Hi,

    I am trying to extract data from a Microsoft Access database using a DSN connection and an SQL query using parameters.

    I am using Visual Web Developer 2005 Express Edition.

    My connection string in the Web.Config file looks like:

    <connectionStrings>
       <add name="testConnectionString" connectionString="Dsn=testDsn" providerName="System.Data.Odbc" />
    </connectionStrings>

    Then I add in a Dataset.xsd item to my project and connect it to the Web.Config connectionstring.  This works fine and I can see all my tables.  I then drag a table from Database Explorer into the Dataset.xsd file to create a tableAdapter.  This works fine.

    I then add a Query to the tableAdapter (using the wizard) that looks like:

    "SELECT * FROM tbl_Test WHERE UserID=?"

    It is at this point, when I click 'NEXT' that I get the following error:

    "The wizard detected the following problems when configuring TableAdapter query "tbl_Test":
    Generated SELECT statement.
         ERROR [HY104][ODBC Microsoft Access Driver] Invalid Precision Value"

    Has anybody exprienced this problem before?  Has anybody worked out how to fix this problem?  I would use an OleDb connection type only the host where this web application is going to sit only has a DSN connection option.

    Thanks in advance.

    Cheers,

    Tuesday, May 15, 2007 7:07 AM

Answers

  • User-821857111 posted

    You can fix the problem by ignoring your host's ridiculous DSN-only option, and placing the access database file in the App_Data folder, where it will be perfectly safe from prying eyes, and you can connect using OLEDB.  That is, if they have the Jet driver installed on the box.  It's certainly worth a go.

    Otherwise you may have to manually code your query and add the parameters, ensuring you provide the correct datatypes and sizes.  Or you could try making this a saved query and calling it in the wizard in the same way as you would a stored procedure in Sql Server. 

    The VS and VWD wizards are not very good with Access.  They often barf over silly things. It may even decide the saved query is a View, and not show it in the list of "stored procedures" for you to select.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 15, 2007 9:21 AM