ArgumentOutOfRangeException on DataGridControl ItemSource

Jan 29, 2013 at 1:07 PM

I'm using following code for filling DataGrid and getting ArgumentOutOfRange on ItemSoures assignment.

 private void DataGridFill()
        {
           string ConString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
            using (SqlConnection con = new SqlConnection(ConString))
            {
                CmdString = "select * from GiuMap";
                SqlCommand cmd = new SqlCommand(CmdString, con);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable("GiuMap");
                sda.Fill(dt);
              }
            DataGridCollectionView view = new DataGridCollectionView(dt.DefaultView);
            
            DataGridGuiMap.ItemsSource = view;
                       
        }

I have vs 2012