Click here to Skip to main content
16,016,345 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
DatabaseHelper dbh=new DatabaseHelper();
                Boolean flag=dbh.ExecuateReader("Select CustMobileNo FROM CustomerMaster",txtMobile.Text.Trim());
                if (flag)
                {
                    errorProvider.SetError(txtMobile, "Duplicate Numbers are not allowed!");
                    MessageBox.Show("Duplicate Numbers are not alllowed!");
                    txtMobile.Focus();
                    txtMobile.SelectAll();
                }



i am not able to convert this code in LINQ to SQL code.!!
how can i do it>???
Posted

1 solution

You haven't given much to go on apart from your own custom code, but I'd have a read of this LINQ Samples[^]

But this is taken from the article

C#
public void Linq47() 
{ 
    List<product> products = GetProductList(); 
  
    var categoryNames = ( 
        from p in products 
        select p.Category) 
        .Distinct(); 
  
    Console.WriteLine("Category names:"); 
    foreach (var n in categoryNames) 
    { 
        Console.WriteLine(n); 
    } 
}
</product>


If you could explain where you are stuck more then we may be able to give you a better answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900