"景先生毕设|www.jxszl.com

C# DataAccessLayer类代码示例

2023-12-29 17:48编辑: www.jxszl.com景先生毕设
本文整理汇总了C#中DataAccessLayer类的典型用法代码示例。如果您正苦于以下问题:C#DataAccessLayer类的具体用法?C#DataAccessLayer怎么用?C#DataAccessLayer使用的例子?这里精选的类代码示例或许可以为您提供帮助。 示例1:Save publicintSave(PriviledgeDBobjDB,SqlTransactionobjTrans) { intPriviledgeID=0; DataAccessLayerobjDataLayer=newDataAccessLayer(); SqlCommandobjCmd=newSqlCommand(); try { objCmd.CommandText="usp_Priviledges"; objCmd.CommandType=CommandType.StoredProcedure; objCmd.Parameters.AddWithValue("@FormID",objDB.FormID); objCmd.Parameters.AddWithValue("@RoleID",objDB.RoleID); objCmd.Parameters.AddWithValue("@viewing",objDB.viewing); objCmd.Parameters.AddWithValue("@PriviledgeID",SqlDbType.Int); objCmd.Parameters["@PriviledgeID"].Direction=ParameterDirection.Output; objCmd.Transaction=objTrans; objCmd.Connection=objTrans.Connection; objDataLayer.Command=objCmd; objDataLayer.ExecQuery(); PriviledgeID=Convert.ToInt32(objCmd.Parameters["@PriviledgeID"].Value); returnPriviledgeID; } catch(Exceptionex) { throwex; } }
原文链接:http://www.jxszl.com/biancheng/C/556838.html