當前位置: 首頁>>代碼示例>>C#>>正文


C# DataBase.Dispose方法代碼示例

本文整理匯總了C#中WSV.DAL.DataBase.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# DataBase.Dispose方法的具體用法?C# DataBase.Dispose怎麽用?C# DataBase.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WSV.DAL.DataBase的用法示例。


在下文中一共展示了DataBase.Dispose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddCurve

 public static bool AddCurve(string Code, WSV.Model.Weight.WeightModel value)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.MyLog.DL_WeightVisitor();
     bool retvalue = true;
     SqlParameter[] prams ={
         db.MakeInParam("@Code",SqlDbType.VarChar,50,Code)
     };
     SqlDataReader Reader = null;
     try
     {
         db.GetDataReader(visitor, prams, out Reader, "AddCurve");
         if (Reader.Read())
         {
             value.StateFun.Curve = (byte[])Reader["Curve"];
         }
         else
         {
             retvalue = false;
         }
     }
     catch (Exception e)
     {
         db.Dispose();
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:32,代碼來源:DL_Weight.cs

示例2: Delete

 public static bool Delete(string S_Pr)
 {
     bool retvalue = true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new CardDAL();
     SqlParameter[] prams =
         {
             db.MakeInParam("@Card",SqlDbType.VarChar,50,S_Pr)
         };
      try
     {
         db.TransactSql(visitor, "Delete", prams);
     }
     catch (Exception err)
     {
         db.Dispose();
         MessageBox.Show(err.Message, "��Ϣ��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return false;
     }
     finally
     {
         db.Dispose();
     }
     return retvalue;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:25,代碼來源:CardBLL.cs

示例3: Data_Add

 /// <summary>
 /// ���������
 /// </summary>
 /// <param name="s_Pr"></param>
 /// <returns></returns>
 public static string Data_Add(string s_Pr)
 {
     string CodeA = "";
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
     SqlParameter[] prams ={
         db.MakeInParam("@Flag", SqlDbType.VarChar,50,s_Pr)
     };
     SqlDataReader dr = null;
     try
     {
         db.GetDataReader(visitor, prams, out dr, "D_Add");
         if (dr.Read())
         {
             CodeA = dr["Code"].ToString();
         }
         dr.Close();
     }
     catch (Exception ex)
     { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return CodeA;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:31,代碼來源:WeightBLL.cs

示例4: BillInfoSql

 /// <summary>
 /// 查詢出所有的數據
 /// </summary>
 /// <returns>返回數據源</returns>
 public static string BillInfoSql(string Code)
 {
     string retSql = "";
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new BillInfoDAL();
     SqlDataReader myread;
     try
     {
         db.GetDataReader(visitor, null, out myread, "BillInfoSql");
         while(myread.Read())
         {
             retSql += "," + myread["DBName"].ToString().Trim()+" as " + myread["Name"].ToString().Trim();
         }
         myread.Close();
         retSql= retSql.Substring(1);
         retSql = "Select " + retSql + " From V_D_Saver_D Where Code='"+Code.Trim()+"'";
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     return retSql;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:31,代碼來源:BillInfoBLL.cs

示例5: MaxID

 /// <summary>
 /// 最大ID
 /// </summary>
 /// <param name="Content"></param>
 /// <returns></returns>
 public static long MaxID()
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.MyLog.DL_Run();
     long ret_V = 0;
     try
     {
         SqlDataReader dr;
         db.GetDataReader(visitor,null,out dr, "MaxID");
         if (dr.Read())
         {
             if(dr[0] !=null)
             ret_V = long.Parse(dr[0].ToString());
         }
         ret_V += 1;
         //ds = db.ReturnDataSet(visitor, prams, "Select");
     }
     catch (Exception ex)
     { return 0; throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return ret_V;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:30,代碼來源:DL_Run.cs

示例6: Insert

 /// <summary>
 /// 插入一條操作記錄,並返回他的編號
 /// </summary>
 /// <param name="Content"></param>
 /// <returns></returns>
 public static string Insert(string Content)
 {
     string ret_Code = MaxID().ToString();
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WSV.DAL.MyLog.DL_Run();
     SqlParameter[] prams ={
         db.MakeInParam("@ID", SqlDbType.BigInt,8, long.Parse(ret_Code)),
         db.MakeInParam("@Code", SqlDbType.VarChar,50,ret_Code),
         db.MakeInParam("@Work", SqlDbType.VarChar,50, Content),
         db.MakeInParam("@InTime", SqlDbType.DateTime,8, DateTime.Now),
         db.MakeInParam("@OperCode", SqlDbType.VarChar,50, Model.User.LUser.Code),
         db.MakeInParam("@TableNum", SqlDbType.VarChar,50, Model.User.LUser.TableNum)
     };
     try
     {
         db.TransactSql(visitor, "Insert", prams);
     }
     catch (Exception ex)
     { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return ret_Code;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:30,代碼來源:DL_Run.cs

示例7: Insert

 /// <summary>
 /// 添加數據
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns>"0101"表示成功,"0"表示失敗</returns>
 public static string Insert(D_CarCodeModel Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new D_CarCodeVisitor();
     bool bSuc = false;
     int nEffectRows = 0;
     SqlParameter[] prams ={
         db.MakeInParam("@ID", SqlDbType.BigInt,50, PublicFun.PublicFun.MaxId("D_CarCode")),
         db.MakeInParam("@Code", SqlDbType.VarChar,50, Item.Code),
         db.MakeInParam("@CarCode", SqlDbType.VarChar,50, Item.CarCode),
         db.MakeInParam("@Tare", SqlDbType.Float,12, Item.Tare),
         db.MakeInParam("@Driver", SqlDbType.VarChar,50, Item.Driver),
     };
     try
     {
         bSuc = db.TransactSql(visitor, "Insert", prams, out nEffectRows);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     if (bSuc && nEffectRows > 0)
         return "0101";
     else
         return "0";
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:32,代碼來源:D_CarCode.cs

示例8: Update

 /// <summary>
 /// 修改數據
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool Update(D_Bill Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new BillDAL();
     bool Flag = false, ReFlag = false;
     int N = 0;
     SqlParameter[] prams ={
         db.MakeInParam("@BillName", SqlDbType.VarChar,50, Item.BillName),
         db.MakeInParam("@PrintTitle", SqlDbType.VarChar,50, Item.PrintTitle),
         db.MakeInParam("@Preview", SqlDbType.Bit,50, Item.Preview),
         db.MakeInParam("@Id", SqlDbType.BigInt,0,Item.Id)
     };
     try
     {
         ReFlag = db.TransactSql(visitor, "Update", prams, out N);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     if (ReFlag && N > 0)
     {
         Flag = true;
     }
     return Flag;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:35,代碼來源:BillBLL.cs

示例9: Update

 public static string Update(Model.Video.D_Video Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.Video.VideoVisitor();
     bool bSuc = false;
     int nEffectRows = 0;
     SqlParameter[] prams ={
                 db.MakeInParam("@VIDEOname",SqlDbType .Char ,10,Item.VIDEO_name),
                 db.MakeInParam("@VIDEOtable",SqlDbType .VarChar ,50,Item.VIDEO_table ),
                 db.MakeInParam("@VIDEOStandard",SqlDbType.Int ,4,Item.VIDEO_Standard ),
                 db.MakeInParam("@VIDEOSource",SqlDbType.Int,4,Item.VIDEO_Source ),
                 db.MakeInParam("@VIDEOBrightness",SqlDbType.Int,4,Item.VIDEO_Brightness ),
                 db.MakeInParam("@VIDEOContrast",SqlDbType.Int,4,Item.VIDEO_Contrast ),
                 db.MakeInParam("@VIDEOHue",SqlDbType.Int,4,Item.VIDEO_Hue ),
                 db.MakeInParam("@VIDEOSaturation",SqlDbType.Int,4,Item.VIDEO_Saturation ),
                 db.MakeInParam("@VIDEOSuality",SqlDbType.Int,4,Item.VIDEO_Suality)
             };
     try
     {
         bSuc = db.TransactSql(visitor, "Set_Video", prams, out nEffectRows);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     if (bSuc && nEffectRows > 0)
         return "0101";
     else
         return "0";
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:31,代碼來源:Video.cs

示例10: CheckKey

 /// <summary>
 /// 檢查主鍵
 /// </summary>
 /// <param name="Tab">表名</param>
 /// <param name="key">要檢查的字段名</param>
 /// <param name="value">要檢查的值</param>
 /// <param name="Id">Id等於0代表添加操作,否則就是修改操作</param>
 public static bool CheckKey(string Tab, string key, string value, long Id)
 {
     bool Flag = false;
     DataBase db = new DataBase();
     SqlDataReader dr = null;
     try
     {
         if (Id == 0)
         {
             db.GetDataReader(out dr, "select * from " + Tab + " where " + key + "='" + value + "'");
             if (dr.Read()) { Flag = true; }
         }
         else
         {
             db.GetDataReader(out dr, "select * from " + Tab + " where Id<>" + Id + " and " + key + "='" + value + "'");
             if (dr.Read()) { Flag = true; }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dr.Close();
         db.Dispose();
     }
     return Flag;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:36,代碼來源:PublicFun.cs

示例11: CheckPwd

 /// <summary>
 /// 檢查用戶密碼
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool CheckPwd(string pass)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new UsersDAL();
     bool Flag = false;
     SqlParameter[] prams ={
         db.MakeInParam("@Uid",SqlDbType.VarChar,50,LUser.Uid),
         db.MakeInParam("@Pwd",SqlDbType.VarChar,50,pass)
     };
     try
     {
         SqlDataReader dr;
         db.GetDataReader(visitor, prams, out dr, "UserLock");
         if (dr.Read())
         {
             Flag = true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     return Flag;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:33,代碼來源:UsersBLL.cs

示例12: Update

 /// <summary>
 /// 修改數據
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool Update(C_Weight Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new WeightDAL();
     bool Flag = false, ReFlag = false;
     int N = 0;
     SqlParameter[] prams ={
         db.MakeInParam("@Save", SqlDbType.Bit,0, Item.Save),
         db.MakeInParam("@Show", SqlDbType.Bit,0, Item.Show),
         db.MakeInParam("@Time", SqlDbType.BigInt,0, Item.Time),
         db.MakeInParam("@Id", SqlDbType.BigInt,0,Item.Id)
     };
     try
     {
         ReFlag = db.TransactSql(visitor, "Update", prams, out N);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     if (ReFlag && N > 0)
     {
         Flag = true;
     }
     return Flag;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:35,代碼來源:WeightBLL.cs

示例13: SelectByName

 /// <summary>
 /// 根據名字查詢編號
 /// </summary>
 /// <returns></returns>
 public static string SelectByName(string Name)
 {
     string Code = "";
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DC_BaseVisitor();
     SqlDataReader dr = null;
     SqlParameter[] prams ={
         db.MakeInParam("@Name", SqlDbType.VarChar,50, Name),
     };
     try
     {
         db.GetDataReader(visitor, prams, out dr, "SelectByName");
         if (dr.Read())
         {
             Code = dr["Code"].ToString();
         }
     }
     catch (Exception ex)
     { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     return Code;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:29,代碼來源:DC_Base.cs

示例14: Insert

 /// <summary>
 /// �������
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static string Insert(Model.Count.D_StatProjectModel Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new DAL.Count.D_StatProjectDal();
     bool bSuc = false;
     int nEffectRows = 0;
     SqlParameter[] prams ={
          db.MakeInParam("@ID", SqlDbType.VarChar,50, PublicFun.PublicFun.MaxId("D_StatProject")),
         db.MakeInParam("@Code", SqlDbType.VarChar,50,PublicFun.PublicFun.MaxId("D_StatProject")),
         db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name),
     };
     try
     {
         bSuc = db.TransactSql(visitor, "Insert", prams, out nEffectRows);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
     finally
     {
         db.Dispose();
     }
     if (bSuc && nEffectRows > 0)
         return "0101";
     else
         return "0";
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:30,代碼來源:D_StatProjectBll.cs

示例15: CheckRolePower

 /// <summary>
 /// 查詢角色是否擁有某個權限
 /// </summary>
 /// <param name="RoleCode">角色編號</param>
 /// <param name="PowerCode">權限編號</param>
 /// <returns></returns>
 public static bool CheckRolePower(string RuleName)
 {
     if (LUser.Id <= 2)
         return true;
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new RoleDAL();
     bool Flag = false;
     SqlParameter[] prams ={
        db.MakeInParam("@RoleCode", SqlDbType.VarChar,50,LUser.Role),
        db.MakeInParam("@RuleName", SqlDbType.VarChar,50,RuleName)
     };
     try
     {
         SqlDataReader dr;
         db.GetDataReader(visitor, prams, out dr, "CheckRolePower");
         if (dr.Read())
         {
             Flag = true;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     return Flag;
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:36,代碼來源:RoleBLL.cs


注:本文中的WSV.DAL.DataBase.Dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。