I have the following instructions with which I intend to obtain a value of a field from an identifier of a table.
idFac = Convert.ToDecimal(Request.QueryString["id"]);//Capturo el Id del registro
sql.Append("SELECT codigo from factura");//aplico la query
sql.Append("WHERE id_factura=idFac");
var registro = db.Database.SqlQuery<factura>(sql.ToString(),idFac);//almaceno la query en la variable registro
var querycredifact = db.creditoes.Where(s => s.codigo == Convert.ToDecimal(registro)); //intento mostrar lo que hay en la query
objcre = querycredifact.FirstOrDefault();
What I intend to do is obtain or reference the codigo
field that you selected in the query, so that you can count on that value to indicate that it is the same in another table.
// what I need is that querycredifact
equals the existing value in the field codigo
I do not know what I'm failing!