No value given for one or more required parameters. ที่ .ExecuteNonQuery()
ขอบคุณพี่ๆ ที่ช่วยเหลือนะครับ
Tag : .NET
Date :
2014-09-02 07:46:04
By :
DarkInSeiOnG
View :
1299
Reply :
7
No. 1
Guest
Code (VB.NET)
Using connection As New SqlConnection("...connection string...")
Using command As SqlCommand = connection.CreateCommand()
Dim sqlSave As String = "Update [MyTable] Set [Customer]=@Customer, [Address]=@Address WHERE [ID]=@ID;"
command.CommandType = CommandType.Text
command.CommandText = sqlSave
command.Parameters.AddWithValue("@Customer", "xxx")
command.Parameters.AddWithValue("@Address ", "yyy")
command.Parameters.AddWithValue("@ID", 8)
connection.Open()
command.ExecuteNonQuery()
connection.Close()
End Using
End Using