OleDbCommand.Prepare 方法需要类型为“14”的参数;有明确设置的 Precision 和 Scale
使用 Visual Studio 2010,我在尝试使用数据集设计器时遇到错误。错误如主题中所述,“OleDbCommand.Prepare 方法要求‘14’类型的参数具有显式设置的精度和小数位数。”
我在 TableAdapter 中创建了一个查询,该查询连接几个表并从连接返回四列。然后,我尝试将列添加到设计器中的数据表并收到错误。 输入查询后,TableAdapter 配置向导结束时也会出现此错误。
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.
除了此错误/警告之外,一切似乎都正常。由于这是自动生成的代码,我不确定从哪里开始查找。
感谢您的帮助!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后,我能够简单地解决这个问题。在数据集设计器中,如果右键单击 TableAdapter,则可以选择查看属性。在属性面板中有一个参数条目。就我而言,它显示“(集合)”并允许我单击它旁边的展开省略号。展开后,您将看到左侧窗格中“成员”下列出的参数。右侧窗格将允许您设置精度和比例。
只要我谈到这个主题,这里就是精度和比例的快速定义。
精度是数字中的位数。小数位数是数字中小数点右侧的位数。例如,数字 123.45 的精度为 5,小数位数为 2。
我希望这对某人有帮助!
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!