我是否知道将Nvarchar转换为数字的错误的可能方法 [英] May I Know The Possible Ways Of Getting Error Coverting Nvarchar To Numeric

查看:96
本文介绍了我是否知道将Nvarchar转换为数字的错误的可能方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以知道获取错误的可能方法是将Nvarchar转换为Numeric.MethodName。我没有FrontEnd源代码,但我是db。我检查了存储过程和表结构。我也检查了Column的大小和类型。在存储过程中,所有参数都具有类似的类型,表的大小。它还在提出问题。当我手动执行相关的存储过程时,数据将插入数据库。对于我目前的来源,所有工作fyn。但是对于运行应用程序的其他源,它会引发运行时错误。

May i know what are the possible ways of getting error "Coverting Nvarchar to Numeric.MethodName". I've no FrontEnd Source Code for that but i've it's db. I checked the stored procedure and Table structure. I checked the Column size and types as well. In stored procedure all the parameters are having similar Types,Size of the table. Still it's raising issue. when im executing relevant stored Procedure manually then data is inserting to the Database. For my present source everything working fyn. But For other source wen im running the application it's raising runtime error as like as that.

推荐答案

如果没有看到生成错误的代码,我们根本无法做到具体。

但是......通常这是一个数据/数据库设计问题:你在字符串字段中存储一个数值,在某些时候你尝试将它转换为数值至少数据库中的单元格包含错误数据。可能是用户犯了错误并且您没有检查输入,因此您尝试将零转换为整数。可能是他错误输入:1O23而不是1023。



更改数据库:在数字字段中存储数值。在DATETIME中存储日期和时间。不要只将所有数据存储在NVARCHAR(MAX)字段中。
Without seeing the code that generates the error we can't be at all specific.
But...normally this is a data / database design problem: you are storing a numeric value in a string field and at some point when you try to convert it to a numeric value at least of of the cells in your database contains bad data. It may be that the user made a mistake and you don't check your inputs, so you are trying to convert "zero" to an integer. It may be that he just mistyped: "1O23" instead of"1023".

Change your DB: store numeric values in numeric fields. Store dates and times in DATETIME. Don't just store all data in NVARCHAR(MAX) fields.


这篇关于我是否知道将Nvarchar转换为数字的错误的可能方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆