How to instantiate DataAccessAdapter

Posts   
 
    
Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 30-Oct-2007 22:56:20   

Im trying to create a DataAccessAdapter like below

        DataAccessAdapter adapter = new DataAccessAdapter();
        ResultsetFields fields = new ResultsetFields(3);
        fields.DefineField(ProductsFields.ProductName,0);

        DataTable dynamicList = new DataTable();
        adapter.FetchTypedList();

I have included, using SD.LLBLGen.Pro.ORMSupportClasses;

Im getting type or namespace cannot be found

DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 30-Oct-2007 23:10:09   

This is not gonna work indeed ! Use it like this (in VB), e.g. :

dim dt as new datatable
dim fields as new resultsetfields(3)
dim bucket as new relationpredicatebucket(ProductFields.ProductCategoryId = 2)

fields.definefield(ProductFields.ProductId, 0)
fields.definefield(ProductFields.ProductName, 1)
fields.definefield(ProductFields.ProductCategoryId, 2)

using adapter as new DataAccessAdapter
      adapter.FetchTypedList(fields, dt, bucket) '<- fills dt
end using
Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 31-Oct-2007 09:47:27   

You didn't post the real code, did you? As that one won't even compile.

I have included, using SD.LLBLGen.Pro.ORMSupportClasses;

That's not enough, there are more namespaces needed to be included.

Im getting type or namespace cannot be found

Please post complete error text to tell you what you need to include.

Hint: if you are using VS2005, right click the un-identified type and select Resolve. This will automatically add the missing namespace, if you have referenced its assembly.

DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 31-Oct-2007 12:55:44   

You didn't post the real code, did you? As that one won't even compile.

That would explain the "state" of the initial code...sunglasses

Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 31-Oct-2007 14:39:18   

No it won't compile... thats why I posted.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 31-Oct-2007 16:01:12   

So did you resolve the missing namespaces?

Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 31-Oct-2007 17:32:17   

Yeah, I have resolved the issue. I'm new to this object creator and didn't know what I was doing exactly. I talked to our senior developer and he set me straight.

According to him, we are using a self-servicing template and the DataAccessAdapter is not available. What I really needed to do was create a TypedList.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 31-Oct-2007 17:35:18   

Alright, good luck and welcome aboard.