SQL 存储过程封装代码生成器

界面图:

生成的代码如下:(通过sqlHelp封装执行)
using System;
using System.Data.SqlClient;
using System.Data;

namespace Etime.BEP
{
 /// <summary>
 ///  ProjectTask
 /// </summary>
 public class ProjectTask
 {
  public ProjectTask()
  {
   //
   // TODO: 在此处添加构造函数逻辑
   //
  }

  #region AddActivityToRole
  /// <summary>
  /// AddActivityToRole
  /// </summary>
  /// <param name="_RoleID"></param>
  /// <param name="_ActivityName"></param>
  /// <returns></returns>
  public static void AddActivityToRole(int _RoleID,string _ActivityName)
  {
   try
   {
    System.Data.SqlClient.SqlParameter[] ps=new SqlParameter[]{
         new SqlParameter("@iv_RoleID",SqlDbType.Int,4),
         new SqlParameter("@iv_ActivityName",SqlDbType.VarChar,50),

                    };
    ps[0].Value =_RoleID;
    ps[1].Value =_ActivityName;

    SqlHelper.ExecuteNonQuery(SqlHelper.CONN_STRING,CommandType.StoredProcedure,"AddActivityToRole",ps);

   }
   catch(System.Data.SqlClient.SqlException ex)
   {
    throw ex;
   }

  }
  #endregion AddActivityToRole

  #region GetUserList
  /// <summary>
  /// GetUserList
  /// </summary>
  /// <returns></returns>
  public static DataSet GetUserList()
  {
   try
   {
    System.Data.SqlClient.SqlParameter[] ps=new SqlParameter[]{

                    };

    
    return SqlHelper.ExecuteDataset(SqlHelper.CONN_STRING,CommandType.StoredProcedure,"GetUserList",ps);

   }
   catch(System.Data.SqlClient.SqlException ex)
   {
    throw ex;
   }

  }
  #endregion GetUserList

  #region updateCharge
  /// <summary>
  /// updateCharge
  /// </summary>
  /// <param name="_typeName"></param>
  /// <param name="_value"></param>
  /// <param name="_ChargeID"></param>
  /// <returns></returns>
  public static void updateCharge(string _typeName,string _value,int _ChargeID)
  {
   try
   {
    System.Data.SqlClient.SqlParameter[] ps=new SqlParameter[]{
         new SqlParameter("@iv_typeName",SqlDbType.VarChar,50),
         new SqlParameter("@iv_value",SqlDbType.VarChar,8),
         new SqlParameter("@iv_ChargeID",SqlDbType.Int,4),

                    };
    ps[0].Value =_typeName;
    ps[1].Value =_value;
    ps[2].Value =_ChargeID;

    SqlHelper.ExecuteNonQuery(SqlHelper.CONN_STRING,CommandType.StoredProcedure,"updateCharge",ps);

   }
   catch(System.Data.SqlClient.SqlException ex)
   {
    throw ex;
   }

  }
  #endregion updateCharge


 }

}



有兴趣联系:edobnet@163.com

posted on 2004-06-04 12:10  edobnet  阅读(4164)  评论(12编辑  收藏  举报