views:

19

answers:

0

Hi everyone,

Here is code for the InnerJoin and I am using MSSQL 2005.

public static DataTable GetItemList()
{
  DataTable dt = new DataTable();
  IDataReader reader = _db.Select 
                          .From<Item>()   
                          .Where(ItemTable.IsDeletedColumn).IsEqualTo(false)                                   
                          .InnerJoin<Account>(ItemTable.AccountIDColumn, AccountsTable.IDColumn)
                          .InnerJoin<AccountType>(AccountsTable.AccountTypeIDColumn, AccountTypeTable.IDColumn)
                          .InnerJoin<TaxCode>(ItemTable.TaxCodeIDColumn, TaxCodeTable.IDColumn)
                          .ExecuteReader();

  dt.Load(reader);
  return dt;
} 

I am getting error in the following line

.InnerJoin<AccountType>(AccountsTable.AccountTypeIDColumn, AccountTypeTable.IDColumn)

Error is "Don't know which column to join to - can't find column AccountTypeID in table Item"

Any idea please...

Thanks, Senthan