HOME > .NET Framework > Forum > ช่วยดูโค๊ดหน่อยจ้า Parameterized Query '(@moo nvarchar(2),@villagename nvarchar(7),@subdistrict nvarchar' expects parameter @oldid, which was not supplied.
ช่วยดูโค๊ดหน่อยจ้า Parameterized Query '(@moo nvarchar(2),@villagename nvarchar(7),@subdistrict nvarchar' expects parameter @oldid, which was not supplied.
conn = New SqlConnection
conn.ConnectionString = strCon
conn.Open()
If vID <> txtMoo.Text Then
strSQL = "select Moo from Village where Moo='" & Trim(txtMoo.Text) & "'"
comm = New SqlCommand(strSQL, conn)
dr = comm.ExecuteReader
If dr.Read Then
MessageBox.Show("รหัสหมู่บ้านที่แก้ไข ซ้ำกับรหัสหมู่บ้านอื่นที่มีอยู่ในระบบอยู่แล้ว กรุณากรอกใหม่อีกครั้ง", "โปรดระวัง..", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
dr.Close()
txtMoo.Focus()
Exit Sub
End If
End If
dr.Close()
strSQL = "update Village set Moo=@moo, VillageName=@villagename, Subdistrict=@subdistrict,District=@district, Province=@province "
strSQL = strSQL & " WHERE Moo=@oldid "
comm = New SqlCommand(strSQL, conn)
comm.Parameters.AddWithValue("@moo", txtMoo.Text)
comm.Parameters.AddWithValue("@villagename", txtVillage.Text)
comm.Parameters.AddWithValue("@subdistrict", txtSubdistrict.Text)
comm.Parameters.AddWithValue("@district", txtDistrict.Text)
comm.Parameters.AddWithValue("@province", txtProvince.Text)
comm.Parameters.AddWithValue("@oldid", vID)
comm.ExecuteNonQuery()
Tag : VB.NET
Date :
2011-02-23 07:55:29
By :
เดือน
View :
1310
Reply :
1
No. 1
Guest
error
Parameterized Query '(@moo nvarchar(2),@villagename nvarchar(7),@subdistrict nvarchar' expects parameter @oldid, which was not supplied.