![](/img/trans.png)
[英]Conversion from type 'DBNull' to type 'String' is not valid. clickable data
[英]am develop for stock management project. but it show for Conversion from string “update product set quantityavail” to type 'Double' is not valid.
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
a = "insert into sales values('" + TextBox15.Text + "','" + TextBox22.Text + "','" + TextBox16.Text + "','" + TextBox17.Text + "','" + TextBox18.Text + "','" + TextBox19.Text + "','" + TextBox20.Text + "','" + TextBox21.Text + "','" + Label13.Text + "','" + Label18.Text + "')"
cmd = New SqlCommand(a, con)
con.Open()
cmd.ExecuteNonQuery()
cmd.Dispose()
con.Close()
MsgBox("insert successfully")
Dim s As Integer
s = TextBox20.Text
a = "update product set quantityavailable=quantityavailable - '" + s + "' where productid='" + TextBox15.Text + "'"
cmd = New SqlCommand(a, con)
con.Open()
cmd.ExecuteNonQuery()
cmd.Dispose()
con.Close()
MsgBox("update successfully")
End Sub
你試一試
update product set quantityavailable=quantityavailable - "+ s.ToString() +" where productid='" + TextBox15.Text + "'"
並嘗試閱讀有關SqlParemeters的信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.