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