📄 taginfos.cs
字号:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
namespace appCopack
{
public class tagInfos
{
DataTable dt;
OleDbConnection myConnection;
OleDbDataAdapter myAdapter;
StreamWriter streamTagLogging = null;
string strLine = "";
string strExportFile = "";
public tagInfos(String myConnectionString)
{
dt = new DataTable();
//------------
myConnection = new OleDbConnection(myConnectionString);
string mySelectQuery = "SELECT * FROM Archive";
try
{
using(OleDbCommand myCommand = new OleDbCommand(mySelectQuery))
{
myCommand.Connection = myConnection;
myAdapter = new OleDbDataAdapter(mySelectQuery, myConnectionString);
myConnection.Open();
myAdapter.Fill(dt);
myConnection.Close();
//
//
//print archive tags to file
//
streamTagLogging = File.CreateText("c:\\data\\tmp\\archive.txt");
streamTagLogging.WriteLine(myConnectionString);
strLine = String.Format("mySelectQuery=\"{0}\"", mySelectQuery);
streamTagLogging.WriteLine(strLine);
foreach (DataRow row in dt.Rows)
{
strLine = String.Format("{0}; {1}; {2:F3}; {3}; {4}", row[0], row[1], row[2], row[3], row[4]);
streamTagLogging.WriteLine(strLine);
}//DataRow
if (streamTagLogging != null) streamTagLogging.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format("Error: Failed to retrieve the required data from the DataBase.\n{0}", ex.Message));
}
}
public DataTable getTaginfos()
{
return dt;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -