日期:2014-05-17 浏览次数:20946 次
sql.Format("select ta.student_number,"+              //c#里面字符串拼接用 + 号
                   ta.student_name,ta.student_class,"+
                   tb.question_number,tb.question_cishu,"+
                   tb.times,d.submit_time,"+
                   tb.score 
              from tb_student_information ta,"+       //当表名过长时,最好个表取个别名
                   tb_student_answered tb 
             where ta.student_number=tb.student_number"+
               and tb.score not like \'%s\'"+          //oracle里面模式匹配使用like而不用!=号
               and ta.student_class not like \'%s\'"+
               and tb.question_cishu like \'%s\'", "0", class_name, times);
------解决方案--------------------
--字符串拼接,要注意双引号和转移字符的使用
sql.Format("select ta.student_number,"+              //c#里面字符串拼接用 + 号
                  "ta.student_name,ta.student_class,"+
                  "tb.question_number,tb.question_cishu,"+
                  "tb.times,d.submit_time,"+
                  "tb.score 
             "from tb_student_information ta,"+       //当表名过长时,最好个表取个别名
                  "tb_student_answered tb 
            "where ta.student_number=tb.student_number"+
              "and tb.score not like \'%s\'"+          //oracle里面模式匹配使用like而不用!=号
              "and ta.student_class not like \'%s\'"+
              "and tb.question_cishu like \'%s\'", "0", class_name, times);
------解决方案--------------------
trace program step by step。