Error converting Bigint to integer using lambda

Asked

Viewed 171 times

0

In the database the guy is BigInt and in C# I’m trying to convert to int and he can convert, but when it comes to instruction lambda, makes a mistake.

 long codpro = Int64.Parse(tb_CodigoProduto.Text.Substring(0,14));
 db = (from p in data.Produtos where p.ProCodInt == codpro select p).FirstOrDefault();
  • You are converting to long nay int and this is correct. Without knowing the error that gives gets a little complicated help. When you ask a question with a code that gives an error, you should post that error, where exactly it gives, in what circumstances, all the relevant parts of the code and if possible a code that can reproduce it: http://answall.com/help/mcve

  • "the 'Procodint' Property on 'Products' could not be set to a 'Int64' value.You must this Property to a non-null value of 'Int32'"

  • What is the type of ProCodInt? Would be a int? Or a int??

  • [Procodint] [bigint] NOT NULL

  • Needs the kind of p.ProCodInt, maybe it is good to put the whole structure of the type of p.

  • 1

    I give up, I hope someone can get the necessary information out of you or I can give you a solution even if you don’t pass on the necessary information.

Show 1 more comment

1 answer

0


Int64 procod = Int64.Parse(string);
  • What do you mean, @Brunorodrigues? Declare the variable as Int64 solved your problem?

  • I posted the answer about what solved my problem and thank you for helping everyone! and who solved it was myself!

  • You may have solved the problem but not this way. This syntax doesn’t even exist. The problem was probably another and was solved in another way. By the presented code it was impossible to solve.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.