Retrieving a single value

Posts   
 
    
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 10-Aug-2005 12:10:02   

Hi,

when I would like to get a single value from the database, based on filter criteria, not using any aggragate functions, for example

select CustomerName where CustomerNo = '123'

while customerNo is the PK. I only need the customerName as read only. Is the best way using a simple ResultSetFields? Doesn't this mean extra work? Is there a simple function that gets a single value from the DB? I am using Selfservicing at the moment.

Gr.,

G.I.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Aug-2005 12:27:46   

Use a scalar query, using GetScalar() on either an entitycollection (selfservicing) or DataAccessAdapter (adapter).

Frans Bouma | Lead developer LLBLGen Pro
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 10-Aug-2005 13:31:48   

OK, I'm using selfservicing, but I just have a filter, not an expression, and not an aggregate function, but when I fill 'null' for both I get an error that aggregate function cannot be null, what should I do in this case?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Aug-2005 16:04:41   

G.I. wrote:

OK, I'm using selfservicing, but I just have a filter, not an expression, and not an aggregate function, but when I fill 'null' for both I get an error that aggregate function cannot be null, what should I do in this case?

Fill in AggregateFunction.None simple_smile

Frans Bouma | Lead developer LLBLGen Pro