vini
vini

Reputation: 4732

Converting SQL to LINQ formatting where clause

 Qry = "select childID,ChildEmail,ChildUserID, ChildPassword from ChildProfile ";
 Qry = Qry + " where ucase(ChildFName) = '" 
           + Strings.UCase(Strings.Trim(Txtname.Text)) 
           + "' and ucase(childlname) = '" 
           + Strings.UCase(Strings.Trim(txtSurName.Text)) 
           + "' and childmobile = '" 
           + Strings.Trim(txtMobile.Text) + "'";

How do we convert this query into LINQ

List<PatientDTO> lstChildProf = objService.GetAllPatient();
    lstChildProf = new List<PatientDTO>(
        from l in lstChildProf where 
        );

Don't know how to write the where clause here

Please help

Upvotes: 0

Views: 293

Answers (1)

Mahmoud Gamal
Mahmoud Gamal

Reputation: 79929

Something like:

List<PatientDTO> lstChildProf = objService.GetAllPatient()
    .Where( l => l.ChildFName == Strings.UCase(Strings.Trim(Txtname.Text))
            && l.ChildName == Strings.UCase(Strings.Trim(txtSurName.Text)) 
            && l.chiuldMob == Strings.Trim(txtMobile.Text))
    .ToList<PatientDTO>();

Upvotes: 1

Related Questions