J'ai le code suivant dans lequel je passe une variable locale à une requête linq pour un enregistrement spécifique, après cet enregistrement je veux vérifier s'il y a un enregistrement selon cet id ou pas.comment passer une variable locale à une requête linq
D'abord, il me donne l'erreur « Cannot implicitly convert type int to bool
»
Deuxièmement, si je veux compter les lignes dans cette requête ou si vous voulez vérifier s'il y a une ligne ou non, comment vais-je faire, voici mon code :
int J_Job_ID = Convert.ToInt32(Request.QueryString["J_Job_ID"]);
//Check If this ID exists in the database
var query = from m in JE.J_Posted_Jobs_Tbl
where m.J_Job_ID = Convert.ToInt32(J_Job_ID)
select m;
Pourquoi convertissez-vous deux fois J_Job_ID? – Alex
Yeap ma mauvaise, je supprimais réellement cette deuxième conversion, mais j'ai oublié à la fin quand posté ce fil, Merci beaucoup frères Walther et Alex –
Pouvez-vous plz répondre à cette question plz Walther et Alex, il sera très apprécié, http: //stackoverflow.com/questions/17523277/how-to-show-multiple-records-in-asp-net-using-ef-linqthe-best-approach –