62,046
社区成员
发帖
与我相关
我的任务
分享
public Model.cxy_NewsC GetModel(int id)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select cxy_NewsC.*,cxy_clsC.clsname from cxy_NewsC left join cxy_clsC on cxy_NewsC.clsid = cxy_clsC.id");
strSql.Append(" where cxy_NewsC.id = @id ");
OleDbParameter[] parameters = {
new OleDbParameter("@id", OleDbType.Integer,4)};
parameters[0].Value = id;
Model.cxy_NewsC model=new Model.cxy_NewsC();
DataSet ds=DbHelperOledb.Query(strSql.ToString(),parameters);
if(ds.Tables[0].Rows.Count>0)
{
if(ds.Tables[0].Rows[0]["id"].ToString()!="")
{
model.id=int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
}
if(ds.Tables[0].Rows[0]["clsid"].ToString()!="")
{
model.clsid=int.Parse(ds.Tables[0].Rows[0]["clsid"].ToString());
}
return model;
}
else
{
return null;
}
}