GetMultiAsDataTable and ResultsetFields

Posts   
 
    
hegeli
User
Posts: 2
Joined: 27-May-2004
# Posted on: 11-Feb-2005 19:14:27   

Hi, Frans!

I am hoping you can tell me what I am doing wrong with the following code. I appreciate your help in advance.

I am trying to specify the columns that I want to return from my Table by using the GetMultiAsDataTable method and here is how my code looks like:

... VendorPriceDAO vendorPrice = new VendorPriceDAO();

ResultsetFields fields = new ResultsetFields(2); fields.DefineField(ApplicationData.VendorPriceFieldIndex.VendorPrice, 0, "VendorPrice"); fields.DefineField(ApplicationData.VendorPriceFieldIndex.ItemNumber, 1, "ItemNumber");

DataTable dt = new DataTable();

bool result = vendorPrice.GetMultiAsDataTable(fields, dt, 0, null, null, null, false, null, null, 0, 0); ...

I have no problems running this code and the boolean result is true after the execution of the statement. However, when I look into the dt (dt.Rows) there are no rows. Also dt.Columns has no columns either.

I have also tried to add the following to see if it would have any impact but I still did not get any rows in the dt.Rows:

  DataTable dt = new DataTable("VendorPrice_t");
  dt.Columns.Add("VendorPrice", System.Type.GetType("System.Decimal"));
  dt.Columns.Add("ItemNumber", System.Type.GetType("System.String"));

Can you help me why I am not getting any data into my DataTable dt?

PS When I do this;

DataTable dt = vendorPrice.GetMultiAsDataTable(0, null, null, null, 0, 0);

I get three rows, so I know my connection, etc. is correct.

Hakan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Feb-2005 21:05:22   

Use the TypedListDAO for this, not the entity's DAO simple_smile

Frans Bouma | Lead developer LLBLGen Pro
hegeli
User
Posts: 2
Joined: 27-May-2004
# Posted on: 14-Feb-2005 06:49:55   

Otis wrote:

Use the TypedListDAO for this, not the entity's DAO simple_smile

Frans,

I must say, when I first saw your reply, I thought you meant that I have to create a Typed List. Then I looked at it one more time and saw that you actually said TypedListDAO, which I wasn't aware of its existance. That is one powerfull object, which I believe is going to change the way I have been doing few things in my project, in a better way!

Thanks again for your reply and for this great tool!