Socarsky
Well-known member
I am face with this error "There is already an open DataReader associated with this Command which must be closed first."  What should I do to fix that?
Adapters conn. string below :
SqlDataAdapter1 connection string : Data Source=SOCARSKY\sqlexpress;Initial Catalog=NORTHWND;Integrated Security=True
SqlDataAdapter2 connection string : Data Source=SOCARSKY\sqlexpress;Initial Catalog=NORTHWND;Integrated Security=True
Btw, I tried to add this "MultipleActiveResultSets=True" to the conn. script but fail.
 
	
		
			
		
		
	
				
			Adapters conn. string below :
SqlDataAdapter1 connection string : Data Source=SOCARSKY\sqlexpress;Initial Catalog=NORTHWND;Integrated Security=True
SqlDataAdapter2 connection string : Data Source=SOCARSKY\sqlexpress;Initial Catalog=NORTHWND;Integrated Security=True
Btw, I tried to add this "MultipleActiveResultSets=True" to the conn. script but fail.
Public Class frmCustomers
    Private Sub frmCustomers_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ' Load the Combo Box
        DsCountries1.Clear()
        SqlDataAdapter2.Fill(DsCountries1, "Customers")
    End Sub
    Private Sub cboCountry_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCountry.SelectedIndexChanged
        ' Get the Parameter object and Set value
        With SqlDataAdapter1.SelectCommand.Parameters
            .Item("@CountryParam").Value = cboCountry.SelectedValue
        End With
        ' Clear the dataset
        DsCustomers1.Clear()
        ' Load the dataset using the parameter value
        SqlDataAdapter1.Fill(DsCustomers1, "Customers")
    End Sub
End Class
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
		
			
		
	
	
		
			
		
		
	
								
							
							 
	 
 
		 
 
		 
	
 
 
		 
 
		 
 
		 
 
		