خرید بک لینک

Vote count: 0

im a begier programmer and im writing a C# application that make query to a database.However I am wondering how could I check that a ID exist(ID is entered by user in the console application) and if it doesnt,display a message.Heres my code:

Console.WriteLine("enter ID");
            try
            {
                var userid = Convert.ToInt32(Console.ReadLine());
                var aquery2 = from test in context.BusinessEntityAddress
                                     where test.Address.StateProvinceID == userid
                                     group test.BusinessEntity.Person.LastName by new { test.BusinessEntityID, test.BusinessEntity.Person.LastName, test.BusinessEntity.Person.FirstName } into balk
                                     select new{
...

didnt paste the whole code but this is the part my question is about.At the line "where test.Address.StateProvinceID == userid" I would like to check if that ID exist in the database,and if it doesnt,display a message.I dont know how to do that.

thank you

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 21 ارديبهشت 1395 ساعت: 5:11

صفحه بندی