数据源的类型无效。它必须是 IListSource、

jylijie jylijie 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
        public tb_NewsType GetModel(int N_TypeId)
{

StringBuilder strSql = new StringBuilder();
strSql.Append("select top 1 N_TypeId,N_TypeName,N_FTypeId from tb_NewsType ");
strSql.Append(" where N_TypeId=@N_TypeId ");
SqlParameter[] parameters = {
new SqlParameter("@N_TypeId", SqlDbType.Int,4)};
parameters[0].Value = N_TypeId;

tb_NewsType model = new tb_NewsType();
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["N_TypeId"].ToString() != "")
{
model.N_TypeId = int.Parse(ds.Tables[0].Rows[0]["N_TypeId"].ToString());
}
model.N_TypeName = ds.Tables[0].Rows[0]["N_TypeName"].ToString();
if (ds.Tables[0].Rows[0]["N_FTypeId"].ToString() != "")
{
model.N_FTypeId = int.Parse(ds.Tables[0].Rows[0]["N_FTypeId"].ToString());
}
return model;
}
else
{
return null;
}
}




this.ddlNewsType.DataSource = ntb.GetModel(model.N_TypeId);
this.ddlNewsType.DataTextField = "N_TypeName";
this.ddlNewsType.DataValueField = "N_TypeId";
this.ddlNewsType.DataBind();

...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
jylijie
.NET社区 62,271 成员 668,968 内容