簡體   English   中英

我為庫存管理項目開發。 但顯示從字符串“更新產品集數量可用”到類型“雙精度”的轉換無效。

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM