string bookRequestNum = txtBookRequestNum.Text.Trim();
string  bookIsbnNum = txtBookIsbnNum.Text.Trim();
sql =  " insert into [Lib_BookBase]  values (null,'" + bookIsbnNum +"','" + bookBarcode + "','" + bookRequestNum + "','" + bookIdentityNum + "','" + bookBaseLocation + "','" + bookPrice + "',0,'" + bookState + "','" + today.ToString("yyyy-MM-dd HH:mm:ss") + "','" + bookRecord + "')";
      提示:sql =  " insert into [Lib_BookBase]  values (null,'" + bookIsbnNum +"','" + bookBarcode + "'
是错误  运算符“+”无法应用于“string”和“方法组”类型的操作数
这个编译器是不是疯了?

解决方案 »

  1.   

    找到原因了bookBarcode应为bookBarCode 
      

  2.   

    建议把字符窜调出来,在sqlserver里面试一下,肯定拼错了吧
      

  3.   

    还有你这个窜我看了头晕,用string.Format()一下
      

  4.   

    断点调试一下啦再整一条SQL语句显示的值是什么,再搞不定就放到SQL Server里看一下有没有错误
      

  5.   

    在C# 里大小写敏感对于这类问题,最好不要设同一名称的变量,
    一类型的变量,可以加下划线区别:如
    Data_selstr,Data_updatstr、Data_insertstrCode_bookBar、Code_bookbuy、Code_bookseal 等
      

  6.   

    this.Text = "我的播放器" + this.comboBoxPlayList.Text.ToString() + ":" + this.listBoxListTracks.SelectedItem.ToString;
    这段代码也出现上面的问题,不知道怎么解决了