本帖最后由 qwangq 于 2013-01-30 21:05:55 编辑

解决方案 »

  1.   

    补充说明下,visual studio2010,自带的sqlexpress数据库。
      

  2.   

    str_state = "SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid='"+TextBox1.Text;多谢楼上提醒,不过,问题依旧啊
      

  3.   

     str_state = "SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid='TextBox1.Text'";你拿出来这条sql语句可以执行吗?
      

  4.   


    str_state = "SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid='"+TextBox1.Text+"'";
      

  5.   

    37行原来的语句是 adsa.Fill(adds,"冷藏车");
    所以老是提示在逗号附近有语法错误。但是我改成adsa.Fill(adds)后,还是提示逗号附近语法错误。
      

  6.   

    初学就用repeater 这个看着就头疼
      

  7.   


    执行后,提示:
    Error source:.net sqlclient data provider
    error message:error converting data type varchar to bigint
      

  8.   

    -- network protocol: LPC
    set quoted_identifier on
    set arithabort off
    set numeric_roundabort off
    set ansi_warnings on
    set ansi_padding on
    set ansi_nulls on
    set concat_null_yields_null on
    set cursor_close_on_commit off
    set implicit_transactions off
    set language us_english
    set dateformat mdy
    set datefirst 7
    set transaction isolation level read committed以上是使用profiler抓到的内容,希望能提供更多信息
      

  9.   

     str_state = "SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid='"+TextBox1.Text+"'";
      

  10.   

    str_state = "SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid="+TextBox1.Text;
      

  11.   

    只是想显示查询结果,不需要order by什么的
      

  12.   

    str_state = String.Format("SELECT hwid,联系方式,冷藏车车牌号,货物温度 FROM 冷藏车 WHERE hwid={0}",TextBox1.Text.Trim();
      

  13.   

    一点一点的调试,查看问题出在那里,一个好的程序员,不仅要能code,更要能找出问题,并迅速解决
      

  14.   


    单独执行SQL语句,没有错误啊!
      

  15.   

    还是SQL语句的问题,改成“select * FROM 冷藏车”就没问题了,所以,原因是“SELECT hwid,联系方式冷藏车车牌号,货物温度 FROM...”标点一个是英文,一个是中文。
      

  16.   

    不过又有新问题了:
    Object reference not set to an instance of an object. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error: 
    Line 36:         // sqlda.Fill(ds, "冷藏车");
    Line 37:         sqlda.Fill(ds);
    Line 38:         if (ds.Tables["冷藏车"].Rows.Count > 0)
    Line 39:         {
    Line 40:             GridView1.DataSource = ds;
     
      

  17.   

    Line 36:         // sqlda.Fill(ds, "冷藏车");
    Line 37:         sqlda.Fill(ds);
    Line 38:         if (ds.Tables["冷藏车"].Rows.Count > 0)兄弟你把  // sqlda.Fill(ds, "冷藏车");这句注释了下面还指定ds.Tables["冷藏车"],不会报错么,你先看下MSDN上面的adapter的用法哦
      

  18.   

    设断点单步调试吧,建议你看看webcast邵志东的视频
      

  19.   

    可以看看webcast哦,邵志东讲的,看完练完你将会有质的飞跃
      

  20.   

    sql写错了,你textbox前面加了'号,后面也要加,匹配呀