当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabase.GetStoredProcCommand方法代码示例

本文整理汇总了C#中SqlDatabase.GetStoredProcCommand方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabase.GetStoredProcCommand方法的具体用法?C# SqlDatabase.GetStoredProcCommand怎么用?C# SqlDatabase.GetStoredProcCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlDatabase的用法示例。


在下文中一共展示了SqlDatabase.GetStoredProcCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldChangeScriptRun

        private bool ShouldChangeScriptRun(int MajorNumber, int MinorNumber, int RevisionNumber, int PatchNumber)
        {
            try
            {

                SqlDatabase db = new SqlDatabase(GetConnectionString());

                string sqlCommand = "_CheckVersion";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "MajorNumber", DbType.Int32, MajorNumber);
                db.AddInParameter(dbCommand, "MinorNumber", DbType.Int32, MinorNumber);
                db.AddInParameter(dbCommand, "RevisionNumber", DbType.Int32, RevisionNumber);
                db.AddInParameter(dbCommand, "PatchNumber", DbType.Int32, PatchNumber);
                db.AddOutParameter(dbCommand, "ReturnValue", DbType.Int32, 0);

                int DataFoundIndicator = 0;

                db.ExecuteNonQuery(dbCommand);
                DataFoundIndicator = Convert.ToInt32(db.GetParameterValue(dbCommand, "ReturnValue"));

                if (DataFoundIndicator == 0)
                {
                    //This means the previous one was found, but the current one was not.
                    return true;
                }
                if (DataFoundIndicator == 1)
                {
                    //This means the current one was not found.
                    return false;
                }
                if (SkipMissingChangeScripts)
                {
                    //If flag is set to skip,then allow skips....
                    Log("File not found for change script (skipped flag set):  " + String.Format("{0:00}", MajorNumber) + "." +
                        String.Format("{0:00}",MinorNumber) + "." + 
                        String.Format("{0:00}",RevisionNumber) + "." + 
                        String.Format("{0:00}",PatchNumber));

                    return true;
                }
                
                throw (new DBBuildException("A file is found to process, but the previous one was not found as processed. "));
            }
            catch (DBBuildException ex)
            {
                Log(ex, "ChangeScriptRun", "DBBuildException");
                throw (ex);
            }
            catch (Exception ex)
            {
                Log(ex, "ChangeScriptRun");
                return false;
            }

        }
开发者ID:mmooney,项目名称:MMDB.Shared,代码行数:56,代码来源:DBBuildHelper.cs

示例2: UpdateChangeScript

        private void UpdateChangeScript(int MajorNumber, int MinorNumber, int RevisionNumber, int PatchNumber)
        {
            try
            {

                SqlDatabase db = new SqlDatabase(GetConnectionString());

                string sqlCommand = "_UpdateVersion";
                DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

                db.AddInParameter(dbCommand, "MajorNumber", DbType.Int32, MajorNumber);
                db.AddInParameter(dbCommand, "MinorNumber", DbType.Int32, MinorNumber);
                db.AddInParameter(dbCommand, "RevisionNumber", DbType.Int32, RevisionNumber);
                db.AddInParameter(dbCommand, "PatchNumber", DbType.Int32, PatchNumber);


                db.ExecuteNonQuery(dbCommand);
            }
            catch (Exception ex)
            {
                Log(ex, "UpdateChangeScript");
            }

        }
开发者ID:mmooney,项目名称:MMDB.Shared,代码行数:24,代码来源:DBBuildHelper.cs


注:本文中的SqlDatabase.GetStoredProcCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。