本文整理汇总了C#中System.Data.OleDb.OleDbCommand.Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbCommand.Cancel方法的具体用法?C# OleDbCommand.Cancel怎么用?C# OleDbCommand.Cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbCommand
的用法示例。
在下文中一共展示了OleDbCommand.Cancel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Command_Cancel
private static void Test_Command_Cancel()
{
using (OleDbCommand cmd = new OleDbCommand("select * from code;", conn))
{
cmd.ExecuteReader();
cmd.Cancel();
OleDbCommand cmd_clone = cmd.Clone();
Assert.AreEqual(cmd.ToString(), cmd_clone.ToString());
}
}
示例2: assignID_A
/// <summary>
/// 分配一级编码
/// </summary>
/// <param name="strIDType">编码规则编号</param>
/// <returns>分配有效的编号</returns>
public static string assignID_A(string strIDType)
{
OleDbConnection m_Conn = Conn.getConn();
try
{
OleDbCommand m_Command = new OleDbCommand("pMaxID_A", m_Conn);
m_Command.CommandType = CommandType.StoredProcedure;
OleDbParameter param;
param = m_Command.Parameters.Add("t", OleDbType.VarChar, 1);
param.Direction = ParameterDirection.Input;
param.Value = "";
param = m_Command.Parameters.Add("strIDType", OleDbType.VarChar, 6);
param.Direction = ParameterDirection.Input;
param.Value = strIDType;
param = m_Command.Parameters.Add("strMaxID", OleDbType.VarChar, 200);
param.Direction = ParameterDirection.Output;
m_Command.ExecuteNonQuery();
string strRet = m_Command.Parameters["strMaxID"].Value.ToString();
m_Command.Cancel();
return strRet;
}
catch (Exception e)
{
throw e;
}
finally
{
m_Conn.Close();
}
}
示例3: getAllSpell
/// <summary>
/// 获得汉字的全拼和简拼
/// </summary>
/// <param name="strWord">汉字</param>
/// <param name="sSpell">传递出来的简拼</param>
/// <param name="sAllSpell">传递出来的全拼</param>
/// <returns>是否成功</returns>
public static Boolean getAllSpell(string strWord,ref string sSpell,ref string sAllSpell)
{
OleDbConnection m_Conn = Conn.getConn();
try
{
OleDbCommand m_Command = new OleDbCommand("GetAllSpell", m_Conn);
m_Command.CommandType = CommandType.StoredProcedure;
OleDbParameter param;
param = m_Command.Parameters.Add("strRSpell", OleDbType.VarChar, 500);
param.Direction = ParameterDirection.Output;
param = m_Command.Parameters.Add("strRASpell", OleDbType.VarChar, 3000);
param.Direction = ParameterDirection.Output;
param = m_Command.Parameters.Add("strString", OleDbType.VarChar, 1000);
param.Direction = ParameterDirection.Input;
param.Value = strWord;
m_Command.ExecuteNonQuery();
sSpell = m_Command.Parameters["strRSpell"].Value.ToString();
sAllSpell = m_Command.Parameters["strRASpell"].Value.ToString();
m_Command.Cancel();
return true;
}
catch (Exception e)
{
throw e;
}
finally
{
m_Conn.Close();
}
}
示例4: ExecuteDataSet
/// <summary>
/// 执行带参数SQL语句
/// </summary>
public void ExecuteDataSet(string commandText, params object[] list)
{
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = getConn().get();
cmd.CommandText = commandText;
for (int i = 0; i < list.Length; i = i + 4)
{
string len = list[i + 2].ToString();
int leng;
if (len != "")
leng = Int32.Parse(len);
else
leng = 255;
cmd.Parameters.Add(list[i].ToString(), chtype(list[i + 1].ToString()), leng);
cmd.Parameters[list[i].ToString()].Value = list[i + 3].ToString();
}
cmd.ExecuteNonQuery();
cmd.Cancel();
cmd.Connection.Close();
cmd.Dispose();
j_read_db_num++;
}
示例5: Read
//.........这里部分代码省略.........
//LogFile2.Wrile2Log("Невозможно загрузить анкету из листа " + currentRow["TABLE_NAME"] + " - недопустимый УНП");
}
}
catch (ArgumentException argumentException)
{
LogFile.Wrile2Log(argumentException.Message);
//LogFile2.Wrile2Log(argumentException.Message);
}
catch (Exception exp)
{
LogFile.Wrile2Log(exp.Message + " Строка - " + currentRowXls +
"\t Столбец - " + currentColumnXls);
//LogFile2.Wrile2Log(exp.Message + " Строка - " + currentRowXls +
// "\t Столбец - " + currentColumnXls);
}
}
}
y++;
}
j++;
}
catch (ArgumentException)
{
dataReader.Close();
dataReader.Dispose();
selectCmd.Cancel();
selectCmd.Dispose();
throw;
}
catch (Exception e)
{
//dataReader.Close();
//dataReader.Dispose();
//selectCmd.Cancel();
//selectCmd.Dispose();
//throw;
}
}
dataReader.Close();
dataReader.Dispose();
selectCmd.Cancel();
selectCmd.Dispose();
indexCurrentTable++;
if (typeAnkt == 1 && tableFound && tmpRowUl["name"].ToString().Length>1)
{
tmpRowUl["login"] = global::Excel2Ankets.Properties.Settings.Default.login;
tmpRowUl["file_name"] = currentFileName;
tmpRowUl["sheet_name"] = currentRow["TABLE_NAME"].ToString();
tmpRowUl["mfo"] = mfo;
tmpRowUl["pack_number"] = porc;
tmpTestDataSet.bd_org_t.Rows.Add(tmpRowUl);
bdOrgTTableAdapter.Update(tmpTestDataSet.bd_org_t);