无法将类型“void”隐式转换为“object”
错误 1 无法将类型“void”隐式转换为“object” c:\inetpub\wwwroot\Shop\WebShop\Admin\AdminManage.aspx.cs 63 45 http://localhost/Shop/WebShop/
private void BindDatagrid_orderinfo() //定单清单
{
DataGrid_OrderInfo.DataSource = adminPub.spBindDatagrid_orderinfo();////此句有问题????
DataGrid_OrderInfo.DataBind();
}
其中adminPub是这样子的
protected AdminPub adminPub = new AdminPub();
其中: /// <summary>
/// 定单清单
/// </summary>
public void spBindDatagrid_orderinfo()
{
ConnOpen();
SqlDataAdapter1 = new SqlDataAdapter( "spBindDataGrid_orderinfo ",SqlConnection1);
SqlDataAdapter1.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet1 = new DataSet();
SqlDataAdapter1.Fill(DataSet1);
}
谢谢
------解决方案--------------------public void spBindDatagrid_orderinfo()
————————————————————》》
改成有返回值的
------解决方案--------------------adminPub.spBindDatagrid_orderinfo(); 返回的是VOID 类型的
需要修改这个方法,返回一个 DATASET
------解决方案--------------------public DateSet spBindDatagrid_orderinfo()
{
ConnOpen();
SqlDataAdapter1 = new SqlDataAdapter( "spBindDataGrid_orderinfo ",SqlConnection1);
SqlDataAdapter1.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet1 = new DataSet();
SqlDataAdapter1.Fill(DataSet1);
return DateSet1;
}
------解决方案--------------------楼上正解!
------解决方案--------------------楼上楼正解!
------解决方案--------------------void 无返回信息你还绑定到数据源?
牛人
--------------------------个性签名-------------------------------------
Web技术群
4446448
关注互联网开发和技术
php、jsp、asp、.net、js、ajax……
-----------------------------------