祝大家八一节快乐,我来送分了,顺便问点问题:)顶者都有分
cs920 2004-07-29 11:19:22 这是我的添加的(ADD)类:
================================this add class==========================
public bool Add(int iType ,string sTitle , string sBody, string datIssue , string datActualize ,string sIssue_DEP , string sFile_NO )
{string strConnection = "Persist Security Info=False;Integrated Security=SSPI;database=GZINFO;server=lkcn";SqlConnection myconn = new SqlConnection(strConnection);
myconn.Open();
SqlCommand mycomm = new SqlCommand("AddLaw" , myconn);
mycomm.CommandType = CommandType.StoredProcedure;
SqlParameter []Param = {
MakeInParam("@iType" , SqlDbType.Int , 0 , iType) ,
MakeInParam("@sBody" , SqlDbType.NVarChar , 4000 , sBody) ,
MakeInParam("@sTitle" , SqlDbType.NVarChar , 50 , sTitle) ,
MakeInParam("@datIssue" , SqlDbType.SmallDateTime , 50 , datIssue) ,
MakeInParam("@datActualize" , SqlDbType.SmallDateTime , 50 , datActualize) ,
MakeInParam("@sIssue_DEP" , SqlDbType.NVarChar , 50 , sIssue_DEP),
MakeInParam("@sFile_NO" , SqlDbType.NVarChar , 50 , sFile_NO),
//------------------------
MakeOutParam("@sError" ,SqlDbType.NVarChar , 50) ,
MakeReturnValueParam()
};
ArrayToCollect(mycomm.Parameters , Param);
mycomm.ExecuteNonQuery();
if((int)mycomm.Parameters["ReturnValue"].Value == 0)
{
m_strError = (string)mycomm.Parameters["@sError"].Value;
return false;
}
return true;
=================================================
=============================以上为添加类
查询类(Query)我该怎么写和调用呢?
顺便给个存储过程,谢谢
public void Query(int nPageIndex , int nPageSize , string strWhere)
{
//int nPageIndex-----------页索引
//int nPageSise -----------页大小,每页显示的条数
//string strWhere----------条件
}