这查询有什么问题吗?请在语法上纠正我,这是错误的,请在此方面纠正我,如何将其连接起来
string cmd = "SELECT * FROM [tbl_students] WHERE course_id=@courseId AND branch_id IN ("+branchId+") AND (@passoutYear is null or passout_year>=@passoutYear) AND (@currentBacklog is null or current_backlog<=@currentBacklog) AND gender=@sex AND (@eGap is null or gapin_education<=@egap) AND (@firstYrPercent is null or first_yea_percent>=@firstYrPercent AND (@secondYrpercent is null or second_year_percent>=@secondYrPercent) AND (@thirdYrPercent is null or third_year_percent>=@thirdYrPercent) AND (@finalYrpercent is null or final_year_percent>=@finalYrpercent) AND (@currentDegreePercentage is null current_degree_percent>=@currentDegreePercentage) AND (@highSchoolPercentage is null high_school_percentage>=@highSchoolPercentage) AND (@higherSchoolPercentage is null higher_school_percentage>=@higherSchoolPercentage) AND (@graduationPercent is null graduation_percent>=@graduationPercentage) AND (@diplomaPercentage is null diploma_percentage>=@diplomaPercenage) AND (@noOfAtkt is null or no_of_atkt<=@noOfAtkt) AND (@date is null or date_of_birth>=@date)";
我想我明白了。
与运行SQL查询相反,您在尝试编译代码时遇到错误?
我敢打赌,您正在使用C#,并且应该在“-符号”之前使用@-符号来制作多行字符串。例如:
string blabla = @" hello there ";
然后当然,当您在打开字符串后 branchId
branchId