0
I need to change the string to int, however it is located within an hql, I probably have to finish the query, but it error to enter the database, my code is a c# with Asp.net, mvc, nhibernate.
public void soma(Rota post)
{
//* Tentativa de criação de query ja foi efetuada e não deu certo.
string hql = "SELECT Km_Atual FROM Rota WHERE Id=LAST_INSERT_ID()";
//* Tentar converter o hql para int, para fazer comparação em if.
int Km_Ultima = Convert.ToInt16(hql);
if (Km_Ultima <= p.Km_Atual)
You’ve asked this before, right?
– Jéf Bueno
What mistake friend
– Jhonatan Jorge de Lima
At one point yes, but it was the whole code and it was another question
– Guilherme Padovam
The error that appears is that "The input string was not in a correct format." when I call this term
– Guilherme Padovam
@Hermepads It’s because you’re trying to convert a string
"SELECT Km_Atual FROM Rota WHERE Id=LAST_INSERT_ID()"
inshort
. That doesn’t make sense. You shouldn’t run the query before?– Jéf Bueno
I’ll try, but last time I said it was a bunch of methods and I couldn’t convert
– Guilherme Padovam