数据源的类型无效。它必须是 IListSource、IEnumerable 或 IDataSource。
这是方法类:publicDataRowGetUserList(){using(SqlConnectioncon=this.Conn){stringsql="select*...
这是方法类:
public DataRow GetUserList()
{
using(SqlConnection con=this.Conn)
{
string sql = "select * from Client_User";
SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
DataTable table = new DataTable();
adapter.Fill(table);
if (table == null && table.Rows.Count == 0)
{
return null;
}
else
{
return table.Rows[0];
}
}
}
后台绑定方法:
if (!IsPostBack)
{
gdvList.DataSource = UserBLL.GetUserList();
gdvList.AutoGenerateColumns = false;
gdvList.DataBind();
} 展开
public DataRow GetUserList()
{
using(SqlConnection con=this.Conn)
{
string sql = "select * from Client_User";
SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
DataTable table = new DataTable();
adapter.Fill(table);
if (table == null && table.Rows.Count == 0)
{
return null;
}
else
{
return table.Rows[0];
}
}
}
后台绑定方法:
if (!IsPostBack)
{
gdvList.DataSource = UserBLL.GetUserList();
gdvList.AutoGenerateColumns = false;
gdvList.DataBind();
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询