SqlCommand.Text里怎么会有"for"语句呢?

解决方案 »

  1.   

    不过,写法就不对了。replace
      
      

  2.   

    不是把n 当作了 标记
    sql中 ; 分号  同样是 语句结束的标记 sqlcommand.commandtext="...for(i=0;i<n'';''i++..."
      

  3.   

    可以使用sql = "insert into xxxx values (?cmd, xxxx";然后
    cmd.Parameters.add("?cmd", text);可以避免' <> & 等等特殊字符串的影响
      

  4.   

    INSERT INTO 提交表 (学号, 密码, 题号, 语言, 源码, ip地址) VALUES ('
            + char(39) + Str_stuid + char(39) + char(44)
            + char(39) + Str_source + char(39) + char(44)
    ...
      

  5.   

    完整的语句是:
          SqlCommand1.CommandText := 'INSERT INTO 提交表 (学号, 源码) VALUES ('
            + char(39) + Str_stuid + char(39) + char(44)
            + char(39) + Str_source + char(39) + ')';
    但是调试时发现SqlCommand1.CommandText的内容少了很多比如:
    '...#include #include int main()...'
    应该是
    #include <stdio.h>
    #include <math.h>
    int main()
    {
    char Bit[9][35];
    int i=0,j=0,k=0;
    int s=0;
    int m=0,temp=1;
    int n=0;
    scanf("%d",&n);
    if(n<1||n>9)
    return ERROR; for(i=0;i<n;i++)
    ...
    调试时实际内容是:
    #include #include int main() { char Bit[9][35]; int i=0,j=0,k=0; int s=0; int m=0,temp=1; int n=0; scanf("%d",&n); if(n<1||n>9) return ERROR; for(i=0;i
      

  6.   

    对不起大家,是我搞错了,没有问题。
    我调试时,用response.redirect(SqlCommand1.CommandText);
    显示当然是把<a等作为标记的,所以没有后面的内容。
    谢谢小新,谢谢各位。