驰骋工作流引擎

注册

 

发新话题 回复该主题

一直ccflow的对mysql数据库支持,效率有点慢,谁能给优化数据库... [复制链接]

1#
一直ccflow的对mysql数据库支持,效率有点慢,谁能给优化数据库连接?
分享 转发
获取最新动态,请关注企业服务号:chichengsoft

学好ccflow,受益一生,多看文档,少走弯路。
TOP
2#

回复 1楼admin的帖子
  1.    /// <summary>
            /// RunSQL_200705_MySQL
            /// </summary>
            /// <param name="sql"></param>
            /// <param name="paras"></param>
            /// <returns></returns>
            private static int RunSQL_200705_MySQL(string sql, Paras paras)
            {
                
                MySqlConnection connOfMySQL = new MySqlConnection(SystemConfig.AppCenterDSN);
                if (connOfMySQL.State != System.Data.ConnectionState.Open)
                {
                    connOfMySQL.ConnectionString = SystemConfig.AppCenterDSN;
                    connOfMySQL.Open();
                }

                int i = 0;
                try
                {
                    MySqlCommand cmd = new MySqlCommand(sql, connOfMySQL);
                    cmd.CommandType = CommandType.Text;
                    foreach (Para para in paras)
                    {
                        MySqlParameter oraP = new MySqlParameter(para.ParaName, para.val);
                        cmd.Parameters.Add(oraP);
                    }
                    i = cmd.ExecuteNonQuery();
                    cmd.Dispose();

                    connOfMySQL.Close();
                    connOfMySQL.Dispose();
                    return i;
                }
                catch (System.Exception ex)
                {
                    connOfMySQL.Close();
                    connOfMySQL.Dispose();
                    throw new Exception(ex.Message + "@SQL:" + sql);
                }
            }
复制代码
获取最新动态,请关注企业服务号:chichengsoft

学好ccflow,受益一生,多看文档,少走弯路。
TOP
发新话题 回复该主题