 |
|
มีเออเร่อตอนกดบันทึกข้อมูลวินโดแอพครับ Conversion from string "INSERT INTO [PRODUCT] ([PRODUCT_" to type 'Double' is not valid. |
|
 |
|
|
 |
 |
|
Conversion from string "INSERT INTO [PRODUCT] ([PRODUCT_" to type 'Double' is not valid.
Code (VB.NET)
Sub adddata()
Dim Conn As New SqlConnection(strCon)
Dim com As New SqlCommand
Dim sql As String = "INSERT INTO [PRODUCT] ([PRODUCT_ID],[PRODUCT_NAME],[PRICE],[TYPE_ID]) VALUES ('" + txtid.Text + "','" + txtname.Text + "','" + txtprice.Text + "','" + ComboBox1.SelectedValue + "') "
Conn.Open()
With com
.Connection = Conn
.CommandType = CommandType.Text
.CommandText = sql
End With
com.ExecuteNonQuery()
End Sub
ในdb PRODUCT_ID เป็น nvarchar
PRODUCT_NAME เป็น nvarchar
PRICE เป็น int
TYPE_ID เป็น int
ขอบคุณคร้าบบ
Tag : .NET, Ms SQL Server 2008, Win (Windows App), VB.NET, VS 2012 (.NET 4.x)
|
|
 |
 |
 |
 |
Date :
2015-07-21 23:41:53 |
By :
yoscs |
View :
782 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|