Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Linq with multiple searches

$
0
0

HI

I have a array of IDs and I want to have a foreach statement iterate each ID to an LINQ database search.   Each ID should be found in the database and be bound to a repeater.  All I get is the last search.  How do I get all the searches?

 Thanks

Herb

 Int64[] AnimalIDs = new Int64[] {109, 115, 114,117};

        foreach (Int64 items in AnimalIDs)
        {
            var QueryList =
              from PersonX in AHData.Owners
              join Animalx in AHData.Animals
              on PersonX.OwnerId equals Animalx.OwnerId
              where Animalx.AnimalId == items
              where Animalx.AnimalKind == AnimalType
              select new
              {
                  Animalx,
                  PersonX,
              };
            foreach (var Personxxx in QueryList)
            {
                RepeaterDogList.DataSource = QueryList;
                RepeaterDogList.DataBind();
            }
        }

="Dogs";





Int64[] AnimalIDs =newInt64[] {109, 115, 114,117};





foreach(Int64items inAnimalIDs)

        {





varQueryList =





fromPersonX inAHData.Owners





joinAnimalx inAHData.Animals





onPersonX.OwnerId equalsAnimalx.OwnerId





whereAnimalx.AnimalId ==items





whereAnimalx.AnimalKind ==AnimalType





selectnew


              {

                  Animalx,

                  PersonX,

              };





foreach(varPersonxxx inQueryList)

            {

                RepeaterDogList



.DataSource =QueryList;

                RepeaterDogList



.DataBind();

            }

        }

    }





Herb Rabe



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>