我有一个包含以下数据的对象:
{
"ItemID": "0000000",
"ConsignmentID": "0000000",
"CountryCreateDate": "24/05/2013 3:20:02 a.m.",
"Reference": "00000000",
"Packaging": "0",
"Weight": "0",
"WeightCubic": "0",
"Length": "0",
"Width": "0",
"Height": "0",
"seqNumber": "0",
"DatePrinted": "",
"ad_Excess": "0",
"Price_Cost": "",
"Price_Other": "",
"Price_OtherTypeID": "",
"FailedReason": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"packedInCustomID": "",
"UpdateDateUTC": "6/06/2013 9:55:05 p.m.",
"PrintedByCustomerUserID": ""
}
这是使用 直接插入到 SQL Server CE 数据库中ExecuteNonQuery
的,它的插入方式或插入方式没有任何问题,并且已经过大量测试和使用。
将此数据插入具有以下架构的表中时,出现错误:
从一种数据类型转换为另一种数据类型时出现语法错误。[ 表达式 = ]
我一遍又一遍地查看数据,似乎没有什么不妥之处。我应该转换日期还是什么?一切都作为类型插入,NVarChar
因为它们都是字符串。
日期格式也是格式d/MM/yyyy h:mm:ss tt
我使用的插入查询是:
INSERT INTO example
(
ItemID,
ConsignmentID,
CountryCreateDate,
Reference,
Packaging,
Weight,
WeightCubic,
Length,
Width,
Height,
seqNumber,
DatePrinted,
ad_Excess,
Price_Cost,
Price_Other,
Price_OtherTypeID,
FailedReason,
PackedInCustomID,
UpdateDateUTC,
PrintedByCustomerUserID
) VALUES (
@ItemID,
@ConsignmentID,
@CountryCreateDate,
@Reference,
@Packaging,
@Weight,
@WeightCubic,
@Length,
@Width,
@Height,
@seqNumber,
@DatePrinted,
@ad_Excess,
@Price_Cost,
@Price_Other,
@Price_OtherTypeID,
@FailedReason,
@PackedInCustomID,
@UpdateDateUTC,
@PrintedByCustomerUserID
)