本文整理汇总了C#中OracleCommand.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# OracleCommand.Cancel方法的具体用法?C# OracleCommand.Cancel怎么用?C# OracleCommand.Cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleCommand
的用法示例。
在下文中一共展示了OracleCommand.Cancel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoWork
public void DoWork()
{
using (OracleConnection conn = new OracleConnection(GlobalUtils.TopSecret.OracleCS))
using (OracleCommand command = new OracleCommand())
{
try
{
conn.Open();
//conn.StatisticsEnabled = true;
command.Connection = conn;
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
return;
}
try
{
using (OracleTransaction sqlTran = conn.BeginTransaction())
{
command.Transaction = sqlTran;
OracleDataReader reader;
List<string> commands = GetCommands(com);
foreach (string c in commands)
{
command.CommandText = c;
using (reader = command.ExecuteReader())
{
ShowResultSet(reader, command);
while (reader.NextResult())
ShowResultSet(reader, command);
}
}
//string out_string;
//int status = 0;
//command.CommandText = "BEGIN DBMS_OUTPUT.GET_LINE (:out_string, :status); END;";
//command.CommandType = CommandType.Text;
//command.Parameters.Clear();
//command.Parameters.Add("out_string", OracleDbType.Varchar2, 32000);
//command.Parameters.Add("status", OracleDbType.Double);
//command.Parameters[0].Direction = System.Data.ParameterDirection.Output;
//command.Parameters[1].Direction = System.Data.ParameterDirection.Output;
//command.ExecuteNonQuery();
//out_string = command.Parameters[0].Value.ToString();
//status = int.Parse(command.Parameters[1].Value.ToString());
//if (!string.IsNullOrEmpty(out_string))
//{
// Console.WriteLine(System.Web.HttpUtility.HtmlEncode(out_string));
//}
//var stats = conn.RetrieveStatistics();
//using (TextWriter tw = new StreamWriter(path + ".stats"))
//{
// tw.WriteLine("Execution time: {0} sec, rows selected: {1}, rows affected: {2}",
// Math.Round((double)(long)stats["ExecutionTime"] / 1000, 2),
// stats["SelectRows"],
// stats["IduRows"]);
//}
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
if (command != null)
command.Cancel();
}
}
}