OleDbCommand.Prepare method requires parameters of type '14' have an explicitly set Precision and Scale

爷,独闯天下 提交于 2019-12-11 05:40:36

问题


Using Visual Studio 2010 and I'm encountering an error when attempting to use the DataSet designer. The error is as stated in the subject, "OleDbCommand.Prepare method requires parameters of type '14' have an explicitly set Precision and Scale."
I have created a query in a TableAdapter that joins a few tables and returns four columns from the join. I then try to add columns to the DataTable in the designer and receive the error. This error also appears at the end of the end of the TableAdapter Configuration Wizard after entering the query.

The wizard detected the following problems when configuring the TableAdapter:"DataTable1":

Details:

    Generated SELECT statement.
    OleDbCommand.Prepare method requires parameters of type '14' have an explicitly set Precision and Scale.

To add these components to your dataset, click Finish.

Everything appears to function OK except for this error/warning. Since this is auto-generated code I'm not sure where to begin looking.

Thanks for any help!


回答1:


In the end, I was able to solve this simply. In the DataSet designer if you right-click on the TableAdapter you can choose to view the Properties. In the Properties panel there is an entry for Parameters. In my case, it displayed '(Collection)' and allowed me to click the expand ellipsis next to it. After expanding you will see the parameters listed under 'Members' in the left pane. The right-hand pane will allow you to set the Precision and Scale.
As long as I'm on the topic, here is a quick definition of Precision and Scale.

Precision is the number of digits in a number. Scale is the number of digits to the right of the decimal point in a number. For example, the number 123.45 has a precision of 5 and a scale of 2.

I hope this helps someone!



来源:https://stackoverflow.com/questions/7825102/oledbcommand-prepare-method-requires-parameters-of-type-14-have-an-explicitly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!