Hi,
I have the following code;
At run time when the button is clicked I receive the error;Code:Dim query As String Dim RefID As New System.Data.SqlClient.SqlCommand(("Select RefNo From dbo.QryRefNo WHERE ChangeRaisedDate = @ChangeRaisedDate"), nextconn) cmd.Parameters.AddWithValue("@ChangeRaisedDate", DateTime.Now.ToString("dd\/MM\/yyyy HH:mm:ss")) Try Using Autoreader As System.Data.SqlClient.SqlDataReader = RefID.ExecuteReader() While Autoreader.Read() Dim RefNo As String = (Autoreader.GetValue(0)) query = "UPDATE dbo.TblChangeControlDet SET RefNo = @RefNo" cmd = New SqlCommand(query, nextconn) cmd.Parameters.AddWithValue("@RefNo", RefNo) cmd.ExecuteNonQuery() End While End Using Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Information, "Spare Elements") End Try
Must declare the scalar variable "@ChangeRaiseddate" - No Update takes place
Why?
Thanks


Reply With Quote
Bookmarks