且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从字符串“"转换输入“整数"无效.

更新时间:2023-11-28 22:50:46

您是否真的对ID列使用了字符串(即char,nchar,varchar或nvarchar)?我希望它是一个将"identity"设置为true的整数,即服务器上自动生成的值.
通常,SQLServer不允许您插入标识值(除非您明确更改了该设置,否则除外).
空字符串永远不是有效的整数值.
我知道MySQL默认允许插入标识值-当您使用"0"时,它将替换为自动生成的值(但我不知道它在该位置如何处理空字符串).
但是,由于您使用的是SQLServer,因此请更改代码:不要在INSERT语句中使用ID值!
Do you really use a string (i.e. char, nchar, varchar, or nvarchar) for the ID column??? I would rather expect it to be an integer with "identity" set to true, i.e. an automatically generated value on the server.
And normally, SQLServer won''t allow you to insert the identity value (except when you explicitly changed that setting).
And an empty string is never a valid integer value.
I know that MySQL allows the insertion of identity values by default - and when you use "0", it replaces that with an automatically generated value (but I do not know how it treats an empty string in that place).
But since you are using SQLServer, change your code: do not use the ID value in the INSERT statement!


检查方法的签名是否如下所述

Check if the signature of the method is as follows

Dim UpdateOrAddNewRecord(Dim ID As String,Dim  Company As String , Dim Name as String,Dim Title as String,Dim Address As String,Dim Country as String,Dim flag as booean)



您需要根据功能更改此方法的签名或上面的代码中声明的数据类型



Either you need to change the signature of this method or the datatypes declared in the above code as per your functionality