please correct me with the sql query

后端 未结 2 1290
梦毁少年i
梦毁少年i 2020-12-22 08:58

Whats wrong wrong with this query please correct me on this syntactcally it\'s going wrong please correct me on this how to concatenate this

string cmd =          


        
相关标签:
2条回答
  • 2020-12-22 10:04

    I think I got it.

    Are you getting an error while trying to COMPILE the code, as opposed to running the SQL query?

    I'm going to bet that you're using C#, and that you should do multi-line strings with an @-symbol before the "-symbol. Such as this:

    string blabla = @"
         hello
         there
    ";
    

    Then of course you need it also when you open up the string after branchId

    0 讨论(0)
  • 2020-12-22 10:04

    First, if branchId is a string, then you'll need these single quotes:

    branch_id IN('"+branchId+"') AND 
    

    though I don't understand why it's not parameterized like so:

    branch_id = @branchId AND 
    

    Second, you may have misspelled the word 'year' in this field name:

    AND  (@firstYrPercent is null or first_year_percent>=@firstYrPercent
    

    Finally, you're missing a few OR's here:

    AND  (@currentDegreePercentage is null OR current_degree_percent>=@currentDegreePercentage)
    AND  (@highSchoolPercentage is null OR high_school_percentage>=@highSchoolPercentage)
    AND  (@higherSchoolPercentage is null OR higher_school_percentage>=@higherSchoolPercentage)
    AND  (@graduationPercent is null OR graduation_percent>=@graduationPercentage)
    AND  (@diplomaPercentage is null OR diploma_percentage>=@diplomaPercenage)
    
    0 讨论(0)
提交回复
热议问题