Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Plz Reply Syntax For Below Expression:

studentDt.DefaultView.RowFilter ="acyear_id='"+ddl_academic_year.ControlValue + "'AND applied_course_id='" + ddl_grade.ControlValue + "'AND emp_id='" + ddl_subject_teacher.ControlValue + "'AND fee_com_subgrp_id='" + ddl_term.ControlValue +"'AND (house_id='" + ddl_house.ControlValue + " OR house_id ='"+string.Empty+"')";

Error Show On line +"'AND (house_id='" + ddl_house.ControlValue + " OR house_id ='"+string.Empty+"')";
Posted

1 solution

C#
// operator AND has precedence over OR operator, parenthesis are needed
dataView.RowFilter = "City = 'Tokyo' AND (Age < 20 OR Age > 60)";

// following examples do the same
dataView.RowFilter = "City <> 'Tokyo' AND City <> 'Paris'";
dataView.RowFilter = "NOT City = 'Tokyo' AND NOT City = 'Paris'";
dataView.RowFilter = "NOT (City = 'Tokyo' OR City = 'Paris')";
dataView.RowFilter = "City NOT IN ('Tokyo', 'Paris')";

These are the basic examples of DataView.Rowfilter
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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