C#代码:调用方式
private static DataTable CACHEDB(string sql)
{
string connectionString = “DSN=Test”;
DataTable result;
try
{
using (OdbcConnection odbcConnection = new OdbcConnection(connectionString))
{
using (OdbcCommand odbcCommand = new OdbcCommand(sql, odbcConnection))
{
using (OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(odbcCommand))
{
DataTable dataTable = new DataTable();
odbcConnection.Open();
odbcDataAdapter.Fill(dataTable);
WriteLog.Write(“CACHE查询到值的总数:” + dataTable.Rows.Count.ToString());
result = dataTable;
}
}
}
}
catch (Exception ex)
{
WriteLog.Write(ex.Message);
result = null;
}
return result;
}
电脑连接方式:控制面板-系统安全-管理工具