public int AddBail()
    {
        string sql = "INSERT INTO [dbo].[C_Work_Bail] (" +
            "[bail_ono], " +
            "[bail_oid], " +
            "[bail_did]," +
            "[bail_type], " +
            "[bail_person], " +
            "[bail_code], " +
            "[bail_money], " +
            "[bail_startday] " +
            "[bail_endday] " +
            "[bail_detainday] " +
            ") VALUES (" +
            "'" + _objno + "' " +
            ",'" + _objid + "' " +
            ",'" + _doid + "' " +
            ",'" + _bailtype + "' " +
            ",'" + _bailperson + "' " +
            ",'" + _bailcode + "' " +
            ",'" + _bailmoney + "' " +
            ",'" + _baildate + "' " +
            ",'" + _enddate + "' " +
            ",'" + _detaintime + "' " +
            ", getdate() " + " );select   @@identity";
        object ret = this.dbProcessor.ExecuteInsert(sql);
        return Convert.ToInt32(ret);
    }运行后报错:'bail_endday'附近有语法错误,哪位大狭帮解决一下啊,多谢~~~

解决方案 »

  1.   

    'bail_endday'是不是DATETIME数据类型的问题啊。
      

  2.   

    你应该把sql语句放到sql中检查一下。是不是数据类型不匹配。
      

  3.   

    ...少了  , 
       "[bail_money], " + 
                "[bail_startday]//又不是最后一个 干吗不写逗号? " + 
                "[bail_endday] " + 
      

  4.   

       "[bail_endday] " + 
     也少逗号..... -.-!...........
      

  5.   

    你数据库是ms sql?得注意时间的类型
      

  6.   

    "[bail_startday] " + 
                "[bail_endday] " + 
    -->
    "[bail_startday], " + 
                "[bail_endday], " + 
    加[,]再试试