tags:

views:

53

answers:

2

what is the above error please correct it

string cmd = @"SELECT * FROM [tbl_students] WHERE course_id=@courseId 
               AND   branch_id IN(" + branchId + @") 
               AND  (@firstYrPercent is null OR first_year_percent>=@firstYrPercent
               AND  (@secondYrpercent is null OR second_year_percent>=@secondYrPercent)
               AND  (@thirdYrPercent is null OR third_year_percent>=@thirdYrPercent)
               AND  (@finalYearpercent is null OR final_year_percent>=@finalYearpercent)
               AND  (@currentDegeePercentage is null OR current_degree_percent>=@currentDegeePercentage)
               AND  (@passoutYear is null OR passing_year>=@passoutYear) 
               AND  (@currentBacklog is null OR current_backlog<=@currentBacklog)
               AND   gender=@sex 
               AND  (@eGap is null OR gapin_education<=@eGap)
               AND  (@highSchoolPercentge is null OR highschool_percentage>=@highSchoolPercentge)
               AND  (@higherSchoolPercentage is null OR ssc_percentage>=@higherSchoolPercentage)
               AND  (@grauationPercentage is null OR graduation_percentage>=@grauationPercentage)
               AND  (@diplomaPercentage is null OR diploma_percentage>=@diplomaPercentage)
               AND  (@noOfAtkt is null OR number_of_ATKT<=@noOfAtkt)
               AND  (@date is null OR DOB>=@date)";
+3  A: 

You have a missing closing parenthesis at the end of the 3rd line:

AND  (@firstYrPercent is null OR first_year_percent>=@firstYrPercent
Daniel Vassallo
yes u r correct but now it's giving exception i am not getting htis exception i am sending all the parameter's proper despite no respiteParameterized Query '(@courseId int,@passoutYear int,@currentBacklog int,@sex int,@eG' expects parameter @eGap, which was not supplied.
NoviceToDotNet
i have tested it with the debugger but of o avail every thing seems fine but it's producing the same error what is the reason please fix it
NoviceToDotNet
i think it's checking or null value parameter as well which i want to truncate if no palue is provided is it true?if so please let me know how can i fix this issue?
NoviceToDotNet
@NoviceToDotNet: I'm sorry but I can't follow. What exception message did you receive?
Daniel Vassallo
+1  A: 

Following line has no closing parenthesis

   AND  (@firstYrPercent is null OR first_year_percent>=@firstYrPercent
Pavel Morshenyuk
yes u r correct but now it's giving exception i am not getting htis exception i am sending all the parameter's proper despite no respite Parameterized Query '(@courseId int,@passoutYear int,@currentBacklog int,@sex int,@eG' expects parameter @eGap, which was not supplied.
NoviceToDotNet
please provide full code of how you executing provided query and exact exception message
Pavel Morshenyuk