在用ASP.net2.0+SQLServer2005做个东西,执行下面这个插入时出现错误:
strsql = "insert into Article(ChannelId,Title,SubTitle,AddDate,Content,ViewNum,Author,Source) values ('" + newsclass.SelectedValue + "','" + title.Text + "','" + sectitle.Text + "','" + System.DateTime.Now.ToString() + "','" + FCKeditor1.Value + "','" + "1" + "','" + author.Text + source.Text + "')";错误提示:
INSERT 语句中列的数目大于 VALUES 子句中指定的值的数目。VALUES 子句中值的数目必须与 INSERT 语句中指定的列的数目匹配。 请各位大侠帮助。

解决方案 »

  1.   


    strsql   =   "insert   into   Article(ChannelId,Title,SubTitle,AddDate,Content,ViewNum,Author,Source)   values   ( ' "   +   newsclass.SelectedValue   +   " ', ' "   +   title.Text   +   " ', ' "   +   sectitle.Text   +   " ', ' "   +   System.DateTime.Now.ToString()   +   " ', ' "   +   FCKeditor1.Value   +   " ', '1', ' "   +   author.Text   + " ',' " + source.Text + " ') "; 
      

  2.   

    你列的字段数目有8个,而你values中的值只有7个,当然会不行咯
      

  3.   

    ' "   +   author.Text   +   source.Text   +   " ') "; 
    中间少个“,”号,这样的话前后数量都不对啊
      

  4.   

    INSERT   语句中列的数目大于   VALUES   子句中指定的值的数目。VALUES   子句中值的数目必须与   INSERT   语句中指定的列的数目匹配。   这句提示很明确了.
      

  5.   

    楼上说的都很对,楼主应该自己检讨一下:
    INSERT   语句中列的数目大于   VALUES   子句中指定的值的数目。VALUES   子句中值的数目必须与   INSERT   语句中指定的列的数目匹配。 
    这个错误信息给的提示是足够的详细了啊 。