-2
你好朋友以下是我的查詢其中displaylist是對象如果stringBuilder有零長度有時,但在這種情況下,它給出錯誤附近FROM語法不正確,所以我如何避免這個問題我需要寫一個在其他如果形式來避免這個或請建議我做一個最好的解決方案,也從來看SQL查詢和asp.net
string cmd = @"SELECT [tbl_course].course_name as Course_Name , [tbl_branch].branch_name as Branch_Name,"[email protected]" FROM [tbl_students], [tbl_course], [tbl_branch]
WHERE [tbl_students].course_id= @courseId
AND [tbl_students].branch_id IN(" + branchId + @")
AND (@firstYrPercent is null OR[tbl_students].first_year_percent>[email protected])
AND (@secondYrpercent is null OR[tbl_students].second_year_percent>[email protected])
AND (@thirdYrPercent is null OR[tbl_students].third_year_percent>[email protected])
AND (@finalYearpercent is null OR[tbl_students].final_year_percent>[email protected])
AND (@currentDegeePercentage is null OR[tbl_students].current_degree_percent>[email protected])
AND (@passoutYear is null OR[tbl_students].passing_year>[email protected])
AND (@currentBacklog is null OR[tbl_students].current_backlog<[email protected])
AND [tbl_students][email protected]
AND (@eGap is null OR [tbl_students].gapin_education<[email protected])
AND (@highSchoolPercentge is null OR[tbl_students].highschool_percentage>[email protected])
AND (@higherSchoolPercentage is null OR[tbl_students].ssc_percentage>[email protected])
AND (@grauationPercentage is null OR[tbl_students].graduation_percentage>[email protected])
AND (@diplomaPercentage is null OR[tbl_students].diploma_percentage>[email protected])
AND (@noOfAtkt is null OR[tbl_students].number_of_ATKT<[email protected])
AND (@validDate is null OR[tbl_students].DOB<[email protected])
AND [tbl_students].branch_i
d=[tbl_branch].branch_id AND [tbl_students].course_id=[tbl_course].course_id";
我意思是我想短路displayLIst,如果它有零長度。 – NoviceToDotNet 2010-08-21 13:40:51
你聽說過「。」嗎? – Eiko 2010-08-21 14:04:42