Question: I have a Navigation Controller in my main view. And I use the following code to add the navigation view when needed.

[self.view addSubview:navController.view];

However, the the navigation bar is not positioned correctly. I have posted a pic below. Anyone knows what is the potential problem?

![alt text](https://i.stack.imgur.com/jxZ7J.png)

Answer: 
Something like this might be an improvement.

```
public List<Invoice> GetInvoices(List<string> invoiceList) {
  List<Invoice> invoices = new List<Invoice>();

  Invoice inv;
  SqlDataReader dr;

  using (SqlConnection con = new SqlConnection(//connection string)) {
    using(SqlCommand cmd = new SqlCommand("dbo.getInvoices", con)) {
      cmd.CommandType = CommandType.StoredProcedure;
      SqlParameter param = cmd.Parameters.Add("invoice", SqlDbType.VarChar);

      foreach(string i in invoiceList) {
        inv = new Invoice();
        param.Value = i;
        using (dr = cmd.ExecuteReader()) {
          while(dr.read())
          {
            // assign values from the database fields
            inv.Property = dr.GetString(0);

            // Add invoice to the result list
            invoices.Add(inv);
          }
        }
      }
    }
  }

  return invoices;
}

```

Then you can use this method like so...

```
var invoiceList = new List<string> { "123", "456", "789" };
var invoices = GetInvoices(invoiceList);
foreach(var i in invoices) {
  Console.WriteLine(i.SomeInvoiceProperty);
}

```
I believe you may want to consider a different approach if you consistently are processing 700 to 1000 or more invoice numbers at one time why not send all the invoice numbers down in a single query instead of many individual query's. As an example you could use an sql in list to do this as in below.

```
select
 *
from
 ivoice_table
where
 invoice_table.invoice_number in (123,124,125,126,127,128 etc....)

```

Enjoy!