By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,735 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,735 IT Pros & Developers. It's quick & easy.

Events/Delegaet/Logging Methods...

P: n/a
Briefly, I have a loop which runs a number of sProcs from a CheckedListBox.
Within this loop I do the following to achieve this...


I need to log to a textbox for each sProc that is run. So I tried the
following which does work but how the hell do I avoid the hard-coding and set
up relevant parameters. ProcToExec is a string taken from a SQL Table which
holds a value such as 'dbo.usp_MISRE_Pivot' which I use in the
RunExecRoutines() to execute the user selections.

I am banging my head off the wall and just can't see a way right now.

Please stop my head-banging.

' Hard Coded :-(
If ProcToExec = "dbo.usp_MISRE_Pivot" Then
ElseIf ProcToExec = "dbo.Routine4" Then
End If

The other way would be to store the values in a database table (along with
their respective parameters), or use a web service or dataset (serialized
locally for example) and get the values from there.

I do not know how to look at the infoMessages of the connections.
I have also tried the table parameter code as follows but I can't seem to
get it to work...


Private Function Log(ByVal ProcToLog)
'How can I process ProcToLog
End Function

ProcToLog in the first loop case is 'PivotLog()' which is a function I want
to execute after the 1st procedure similarly;
ProcToLog is 'Routine4Log()' which is a function I want to execute after the
2st procedure completes

Am I thinking about this the right way. I have also tried CASE statements
but just can't seem to get the right syntax...

come on guys give me a dig out here ;-(


I tried to code to each of my sProcs raise an event when it finishes -then
try to map the next routine to be run as the eventhandler something as
follows but after much reading cryptic web pages on this OO technique, I
don't see the light...

Public Event Routine4Completed

'Do your routine
Raise Event Routine4Completed

Elsewhere in my code - I tried to simply map my event handler
AddHandler MyRoutines.Routine4Completed, _
AddressOf NextStep

That way I thought I could map the routine to different code -if the need
arose. And I would then only have to worry about call the specific routine
that the user indicated in the CheckedListBox.

More info:
I execute a set of sProcs within a loop which executes RunExecRoutines() for
each sProc checked as follows...

cmd.Parameters.Add("@pRESULT", SqlDbType.Int)
cmd.Parameters(0).Direction = ParameterDirection.Output


After each iteration I want to create a specific log file created for that
procedure. Each sProc has a specific log function call such as pivotLog() or

I am more confused noew than when I please

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.