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
需要检查查询语句,因为即使将字符串转换为double后它也会生成错误。 我正在使用access2000和vb.net 2005
答案 0 :(得分:0)
尝试
qr = "insert into tbshare_purchase(share_purchase) values(" & cstr(dub) & ")"'
答案 1 :(得分: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))' –