Tuesday, September 27, 2016

To check the If Exist condition (SqlServer) in linq using c#



public void IfExist(string username)
        {
            var name = dbcontext.userdetails.Any(s => s.username == username);

            if (name == true)
            {
                Console.WriteLine("Record Exists");
            }
            else
            {
                Console.WriteLine("Record Does Not Exists");
            }
        }

To check if any record exist in the table using linq c#



public void CheckRecordExistOrNot()
        {
            var query = (from td in dbcontext.taskdetails select td).ToList();

            if (query.Count > 0)
            {
                Console.WriteLine("Record Exists");
            }
            else
            {
                Console.WriteLine("Record Does Not Exists");
            }
        }

The type parameter 'Entity_Code.display_Result' in ExecuteFunction is incompatible with the type 'bmModel.display_Result' returned by the function



If you get the following error while displaying the data using procedure then follow the below steps :-


Then go to the procedure and select the procedure and select goto definition


Then check the class names if the class names are same and the column names of the results from the table are same 



Now check if the column names from the table are same

 

Now if the result from the table and the class names are not same then change the class names both must be same

Git Commands

Git Version   To check the git version Git -v       Git Clone To clone the repository, use the following command: Git clone [u...