映射xml文件书写如下
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Member" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation=" SQLMap.xsd">
<mapsrésultat>
<resultMap id="SelectResult" class="PlatAdmin.Model.Member">
<result property="Id" column="id" />
<result property="Identityno" column="identityno" />
<result property="Téléphone" column="téléphone" />
<result property="Email" column="email" />
<result property="Linktel" column="linktel" />
<result property="Adresse" column="adresse" />
<result property="Content" column="content" />
<result property="Nom d'utilisateur" column="nom d'utilisateur" />
<result property="Mot de passe" column="mot de passe" />
<result property="Truename" column="truename" />
<result property="Enable" column="enable" />
<result property="Regdate" column="regdate" />
</resultMap>
</resultMaps>
<parameterMaps>
<parameterMap id="swapParas" class="PlatAdmin.Model.Member">
<parameter property="querystr" column="" />
<parameter property="keyfield" column="" />
<parameter property="pagesize" column="" />
<parameter property="pagenumber" column="" />
</parameterMap>
</parameterMaps>
<déclarations>
<procedure id="GetMemberList" ParameterMap="swapParas" resultMap="SelectResult">
usp_GetRecordset
</procédure>
</déclarations>
</sqlCarte>
程序代码如下 :
public IList GetMemberList (string querystr, int pageNo)
{
Table de hachage ht = new Hashtable();
ht.Add("querystr",querystr);
ht.Add("champ clé", "id");
ht.Add("taille de la page",2);
ht.Add("numéro de page", numéro de page);
SqlMapper sqlMap = IBatisNet.DataMapper.Mapper.Instance();
essayer
{
return sqlMap.QueryForList("GetMemberList",ht);
}
attraper (Exception e)
{
lancer une nouvelle IBatisNetException(e.Message,e);
}
}
出处:福娃莹莹 BLOG