By the way, I did add some close and dispose statements as shown below trying to clear everything. Not sure I've got them in the right places.
Code:Private Sub RunSproc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunSproc.Click Dim spSteps As SqlCommand If useLocalDB Then spSteps = New SqlCommand("sproc_shop_order_get_recipe1", cnPMSQL_Local) Else spSteps = New SqlCommand("sproc_shop_order_get_recipe1", cnPMSQL_Remote) End If spSteps.Parameters.AddWithValue("@int_shop_order", "152837000001") spSteps.Parameters.AddWithValue("@int_prev_so", "459761000001") spSteps.CommandType = CommandType.StoredProcedure spSteps.CommandTimeout = 15 tblSteps.Clear() Try Dim StepsAdapter As SqlDataAdapter = New SqlDataAdapter(spSteps) MessageBox.Show(spSteps.Connection.ConnectionString) StepsAdapter.Fill(tblSteps) StepsBindingSource.DataSource = tblSteps dgSteps.DataSource = StepsBindingSource StepsAdapter.Dispose() Catch ex As Exception Trace.WriteLine(Date.Now.ToLongTimeString & "*: Database not available" & ex.Message) MessageBox.Show("Database not available" & Environment.NewLine & ex.Message & Environment.NewLine & ex.StackTrace) End Try cnPMSQL_Local.close() cnPMSQL_Remote.close() spSteps.Dispose() End Sub




Reply With Quote