c#连接intersystem cache数据库的方法

2022-04-14 00:00:00 专区 订阅 连接 付费 原文

连接cache数据库需要InterSystems.Data.IRISClient.dll

1、官网介绍关于c#连接cache

2、官方的c#连接cache的demo,github地址

自己去下载demo,拿到dll吧



原始的连接数据库方式

setting.ConnectionString = "Server=172.0.0.1;Namespace=ddd-app;Password=DDDDDy;User ID=DDDDDy;";//端口是默认 Port = 1972,所以我省略了
IRISADOConnection connection = new OdbcConnection(setting.ConnectionString);
connection.Open();

String sql = "SELECT view_name FROM user_views";
IRISCommand cmd = new IRISCommand(sql, connection);
IRISDataReader reader = cmd.ExecuteReader();

while (reader.Read())
{
//DateTime date = (DateTime)reader[reader.GetOrdinal("TransDate")];
//decimal open = (decimal)reader[reader.GetOrdinal("StockOpen")];
//decimal high = (decimal)reader[reader.GetOrdinal("High")];
//decimal low = (decimal)reader[reader.GetOrdinal("Low")];
//decimal close = (decimal)reader[reader.GetOrdinal("StockClose")];
//int volume = (int)reader[reader.GetOrdinal("Volume")];
//String name = (string)reader[reader.GetOrdinal("Name")];
//Console.WriteLine(date.ToString("MM/dd/yyyy") + "\t" + name + "\t" + open + "\t" + high + "\t" + low + "\t" + close + "\t" + volume);
Console.WriteLine((string)reader[0]);
}

————————————————
版权声明:本文为CSDN博主「珍珠奶茶爱好者」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/clmmei_123/article/details/116057145

相关文章