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


C# dataAccess.ExecGetDataTable方法代码示例

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


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

示例1: ReIDSteps

        private bool ReIDSteps(ref dataAccess.acTransaction oTrans, string sUserID, string sTaskID, ref string sErr)
        {
            //We join this to task_step on step_id, and only issue new GUID's
            //to the rows that are in conflict.

            //saves time, and if no steps are in conflict, the imported version is an exact match of the
            //exported one.
            //( and yes, I realize I did not join task_step on the task_id.
            // thats because the step_id is a guid AND the PK on the table.  not necessary to check
            // it against task_id too.)
            oTrans.Command.CommandText = "select its.step_id" +
                " from import_task_step its" +
                " join task_step ts on its.step_id = ts.step_id" +
                " where its.user_id = '" + sUserID + "'" +
                " and its.task_id = '" + sTaskID + "'";

            DataTable dtSteps = new DataTable();
            if (!oTrans.ExecGetDataTable(ref dtSteps, ref sErr))
                throw new Exception(sErr);

            if (dtSteps.Rows.Count > 0)
            {
                foreach (DataRow drSteps in dtSteps.Rows)
                {
                    //update each row by:
                    //*) getting a new guid
                    //*) searching for references to the old ID and replacing them
                    //  specifically in function_xml
                    //*) updating the row with the new guid

                    string sOrigStepID = drSteps["step_id"].ToString();
                    string sNewStepID = ui.NewGUID();

                    //this will update any references in function_xml with
                    // the new guid of this step

                    oTrans.Command.CommandText = "update import_task_step" +
                        " set function_xml = replace(function_xml, '" + sOrigStepID + "', '" + sNewStepID + "')" +
                        " where ifnull(ExtractValue(function_xml, '(//*[. = ''" + sOrigStepID + "''])'), '') <> ''";
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception(sErr);

                    //then finally, we will update the actual step rows with the new id
                    oTrans.Command.CommandText = "update import_task_step" +
                        " set step_id = '" + sNewStepID + "'" +
                        " where step_id = '" + sOrigStepID + "'";
                    if (!oTrans.ExecUpdate(ref sErr))
                        throw new Exception(sErr);

                }
            }

            return true;
        }
开发者ID:remotesyssupport,项目名称:cato,代码行数:54,代码来源:ImportExport.cs


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