views:

10

answers:

1

I have a linqtosql dbml where I dropped a stored procedure into the designer interface.

Stored procedure name: GetUser(@userid int)

Select * from users_tbl where userid=@userid

Now in the code I want to do something like this:

Dim db as new UserDataContext

Dim myuser as users_tbl = db.GetUser(1)

How can I tell if GetUser returned a user or not?

+1  A: 

If it returns a record, users_tbl will not be null and will not have a .Count() of 0.

kbrimington
Though GetUser returns a single record and users_tbl doesn't seem to have a .Count() method available.I guess comparing null is the best here.
metanaito
Thanks. I couldn't be sure whether your particular procedure returned a collection or not.
kbrimington