Going Twice to the DB vs Join- In Order To Get Siblings RRS feed

  • Question

  • User933695886 posted


    I have a simple parent and child entitis: Country, City. City has Country_Id and City_Id.

    I need to write a DAL method that recives a City_Id as a parameter, and manipulates the given city and some other cities in the country.

    My DAL is ADO.NET to a DATASET class generated by the Visual Studio 2008.

    What would be a better practice:

    1. Going twice to the DB: Using SqlDataReader to retrieve the Country_Id and then SqlDataAdapter to fill my DataTable?
    2. Going once to the DB: Using SqlDataAdapter to bring the right cities by join self Cities table on Country_Id?
    3. Another way?


    Thursday, August 25, 2011 8:32 AM


  • User269602965 posted

    do the join with indexed parameters

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 25, 2011 1:46 PM