//我的定单信息
    protected void GetAllOrderInfo()
    {
       // string goods = Request.QueryString["orderId"].ToString();
        goods = Request.QueryString["orderId"];
        string sql = string.Format("select * from orders  where goods='{0}'", goods);
        DataSet ds = SqlDatabase.ExecuteDataset(DataProvider.ConnectionString,CommandType.Text,sql);
       
       
        dllMyOrderInfo.DataSource = ds;
        dllMyOrderInfo.DataBind();
        dllMyOrderInfo.Visible = true;
        
    }
这是报的错误
Line 598:
Line 599: // 填充DataSet.
Line 600: da.Fill(ds);
Line 601:
Line 602: cmd.Parameters.Clear();
 Source File: d:\wwwroot\mmrddnew\App_Code\database\SqlDatabase.cs    Line: 600 Stack Trace: 
[SqlException (0x80131904): 子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。] 
查出来有2条数据,
我主要是想得到订单信息!!1条就可以了!!请问有什么办法解决!!急求解决!!!

解决方案 »

  1.   

    试试 select * from orders  where goods  in ('{0}')
      

  2.   

    string.Format("select * from orders  where goods='{0}'", goods); 
    两种情况 In 或者改为连接查询 因为goods='{0}'后只能是一个值 而Goods是个字段 没什么意义 一定是逻辑错了! 
      

  3.   

    SQL Server: select top 1 * from orders  where goods='{0}
    Oracle: select * from orders  where goods='{0} and rownum<2
      

  4.   

    不过我认为是你的goods的参数错误
      

  5.   

    是我看错了!你应该设个断点看一下最后的SQL语句
      

  6.   

    goods 是一个参数,“订单号”  因为我同时定2种商品,数据里面有2条数据,但是订单号都相同!
    我只定一种商品就不报错接收人:李宁 
    地址:aaaaaaaa 
    物流名称:快递配送 
    邮编:518000  支付方式: 支付宝支付
     
    这是正确的显示!!现在我定2种以上的话就报错了!!就是上面的那种错误,怎么解决呢????
      

  7.   

    你那SQL语句严重有问题,设断点,打开即时窗口,打出sql语句自己调试一下看对不对