Jump to content

[Resolvido] Erro com código (retorno nulo)


Recommended Posts

Tenho este código,

Dim categories = From p In context.ARMAZEM _
															 Where p.IdCODIGO = .Id
															 Group p By p.IdCODIGO Into Group _
															 Select Quant = Group.Sum(Function(p) p.Quant)

					 If IsNothing(categories.FirstOrDefault.Value) Then
						 arm = categories.FirstOrDefault.Value
					 End If

que quando faz a pesquisa e se não existir nada na base com aquele id da-me este erro:

- Nullable object must have a value.

🙂 Alguem me pode ajudar?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.