Question : Execution of stored procedures from win form

Hello,
Help would be appreciated:
I'm executing n number of stored procedures from windows form by running vb code below. After I run execution I expect to see which batch and sp is currently executing (Label 7 and Label 8) as well as my picture box. For some unknown reason it shows on my windows form only after all procedures from the list are actually executed (actually only information related to last executed procedure). I would like to see information in the moment of the execution of each particural stored procedure currently executing. It seem like it's to fast to show related informations before it actually run the execution. how can I make this working (i presume I should have a kind of pause in order to populate all information in my labels?!)
Please help...
Thank you
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Private Sub Execute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Execute.Click
        Dim item As String
        Dim node As TreeNode
        node = TreeView1.SelectedNode
        
        For Each item In CheckedListBox1.CheckedItems
            Me.Label4.Visible = True
            Me.PictureBox1.Visible = True
            Me.Label7.Visible = True
            Me.Label8.Visible = True
            Me.Label7.Text = node.Text
            Me.Label8.Text = item

            Dim con As New SqlConnection(My.Settings.MyConnectionString)
            con.Open()

            Dim cmd As New SqlCommand()
            cmd.Connection = con
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = item
            cmd.CommandTimeout = 0
            cmd.ExecuteNonQuery()
        Next

        MessageBox.Show("All selected procedures successfully executed!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, False)

    End Sub

Answer : Execution of stored procedures from win form

I'm not sure about the structure of the search table either. But if each location is stored as a separate record, I'd use a simple JOIN and IN (...) clause.  It's not clear whether it should be an INNER or OUTER join, but ...

<cfparam name="FORM.Location" default="">

<cfquery....>
SELECT   Columns
FROM      SearchTableName sr INNER JOIN LocationTableName loc ON
                        sr.LocationName = loc.LocationName
WHERE  ID = ID
.....
<cfif listLen(form.location)>
      AND loc.strLocationCode  IN
     (
      <cfqueryparam value="#form.location#" list="true" cfsqltype="(your data type)">          
      )
</cfif>

If the locations ARE are stored as comma delimited list (less than ideal), then you'd probably have to resort to looping and the old LIKE hack

Random Solutions  
 
programming4us programming4us