新近写了个通用的数据库访问类(c#);支持oledbsqloracleodbc数据连接,
提供sysbase,db2 的接口支持,
如果有什么错误、意见、建议。请联系我
[email protected]http://mail.gongyi.gov.cn/netdisk/
[email protected]&id=2712a90f0de399014bfbea6e697381a3&filename=L7mk1/cvTXlQRE8ucmFy&language=gb
经过不完全测试:
测试代码:
using System;
using System.Collections;
using System.IO;
using NUnit.Framework;
using MyPDO.DataAccess;
namespace DataAccessTest
{
///
/// Class1 的摘要说明。
/// [TestFixture]
public class DataAccessTest
{
public DataAccessTest()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
private MyPDO.DataAccess.DataAccessor DBA;
[SetUp]
public void SetUp()
{
DBA = new DataAccessor();
DBA.ConnectString = "Provider=SQLOLEDB;data source=10.10.25.63;initial catalog=Master;user id=zha;Password=123;";
DBA.ConnectType = MyPDO.ConnectType.OleDbDataDriver;
DBA.Open();
Assert.IsTrue(DBA.IsOpen,"DBA closed");
}
[Test]
public void ExecuteNonQueryTest()
{
Hashtable hsTable = new Hashtable();
hsTable.Add("A","select * from myfiles");
DBA.
Assert.IsTrue(DBA.IsOpen,"DBA closed");
if (DBA.IsOpen == true)
{
DBA.ExecuteNonQuery(hsTable); }
}
[Test]
public void GetDataSetTest()