本文整理汇总了C#中IBM.Data.DB2.DB2Connection.CreateCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DB2Connection.CreateCommand方法的具体用法?C# DB2Connection.CreateCommand怎么用?C# DB2Connection.CreateCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBM.Data.DB2.DB2Connection
的用法示例。
在下文中一共展示了DB2Connection.CreateCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: queryPrimaryWS
public void queryPrimaryWS()
{
DB2Connection conndb2 = new DB2Connection(globalConnStringDb2);
try
{
conndb2.Open();
DB2Command cmd = conndb2.CreateCommand();
DB2Transaction trans = conndb2.BeginTransaction();
cmd.Transaction = trans;
cmd.CommandText = "" + rtPrimaryWS.Text;
tbPrimWS.Text = cmd.ExecuteScalar().ToString();
string strLog = System.DateTime.Today.ToShortDateString() + " LOG : Ran TA00WB.WORK_SUMMARY Query. " + tbPrimWS.Text + " rows [email protected]";
strLog = strLog.Replace("@", "" + System.Environment.NewLine);
rtLogging.AppendText(strLog);
//logger
string logFilePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
using (TextWriter outputFile = new StreamWriter(logFilePath + @"\WBArchiving.txt", true))
{
outputFile.Write(strLog);
}
conndb2.Close();
}
catch (Exception e)
{
tbPrimWS.Text = " ";
MessageBox.Show("An error was encountered during runtime. Please try again.\n\n" + e.GetBaseException().Message, "TA00WB.WORK_SUMMARY Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
string strArchWSLog = System.DateTime.Today.ToShortDateString() + " LOG : Ran TA00WB.WORK_SUMMARY Query. Error occured. No" + tbPrimWS.Text + "rows [email protected]";
strArchWSLog = strArchWSLog.Replace("@", "" + System.Environment.NewLine);
rtLogging.AppendText(strArchWSLog);
}//catch
}
示例2: queryBoundaryDate
public void queryBoundaryDate()
{
DB2Connection conndb2 = new DB2Connection(globalConnStringDb2);
try
{
conndb2.Open();
DB2Command cmd = conndb2.CreateCommand();
DB2Transaction trans = conndb2.BeginTransaction();
cmd.Transaction = trans;
cmd.CommandText = "" + rtCheckBoundary.Text;
tbBoundaryDate.Text = cmd.ExecuteScalar().ToString();
string strBoundaryLog = System.DateTime.Today.ToShortDateString() + " LOG : Ran Archive Boundary Query. Current boundary date is " + tbBoundaryDate.Text + "@" ;
strBoundaryLog = strBoundaryLog.Replace("@", "" + System.Environment.NewLine);
rtLogging.AppendText(strBoundaryLog);
conndb2.Close();
}
catch (Exception e)
{
MessageBox.Show("An error was encountered during runtime. Please try again.\n\n" + e.GetBaseException().Message, "Check Archive Boundary Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}