-2
str = dgemp_monthlyshare.Item(3, i).Value 'value to fetch from datagrid
db = CInt(Val(str))
Double.TryParse(str, dub)              
qr = "insert into tbshare_purchase(share_purchase) values('" + dub + "')"' here generates error

需要检查查询语句,因为即使在字符串转换为双精度后也会产生错误。我在 vb.net 2005 中使用 access2000

4

2 回答 2

0

尝试

qr = "insert into tbshare_purchase(share_purchase) values(" & cstr(dub) & ")"'
于 2013-09-18T14:01:05.637 回答
0

我知道了!MS-access 需要以下字符串格式来存储数字。

qr = "insert into tbshare_purchase(share_purchase) values(@share_purchase)"' `     `da = New OleDbDataAdapter(qr, con)' 'da.SelectCommand.Parameters.AddWithValue("@share_purchase", 'Convert.ToInt32(str))' –
于 2015-10-11T05:51:06.643 回答