I need to code a service program that will perform database commands against an AS400/Iseries throughout the day when various events. Does it matter if I create a new command each time I need to issue a command or should I create the commands once in the OnStart stage of the service program and merely change the parametr values? In other words should the bracketed code below within '*** ONLY IN THE ONSTART??? ***' appear once in the Onstart rather than on each occurrance of the event?.
Code:
' *** ONLY IN THE ONSTART??? *****
Dim SSLTSTBadDataCommand As New iDB2Command
SSLTSTBadDataCommand = As400Connection.CreateCommand
SSLTSTBadDataCommand.CommandType = CommandType.Text
SSLTSTBadDataCommand.CommandText =
"UPDATE SSLTST01P1 SET A1BAD = 'Y' " +
"WHERE A1TS05 = @item " +
SSLTSTBadDataCommand.DeriveParameters()
' *** ONLY IN ONSTART ??? *****
SSLTSTBadDataCommand.Parameters("@item").Value = strKeyItem
SSLTSTBadDataCommand.ExecuteNonQuery()
Dazed and confused.
Remember.. 'Depression is just anger without enthusiasum'.