日期:2014-05-17  浏览次数:20853 次

VC++ 2005开发环境下,怎么连接oracle数据库?急!
VC++   2005开发环境下,怎么连接oracle数据库?


------解决方案--------------------
ADO.NET
OCI
ODBC应该都可以的


------解决方案--------------------
public class DataConntion
{


public OleDbConnection dbConn=null;

/// <summary> 事务 </summary>
/// <author> wangbin </author>
/// <description> 事务 </description>
private OleDbTransaction myTrans;
public DataConntion()
{
dbConn=new OleDbConnection( "你的连接字符串 ");
}
private void Open()
{
try
{
dbConn.Open();
}
catch
{
Exception msg = new Exception( "数据库连接错误 ");
throw msg;
}
}

private void Close()
{
try
{
if (dbConn.State == ConnectionState.Open ) dbConn.Close();
}
catch
{
Exception msg = new Exception( "数据库关闭错误 ");
throw msg;
}
}
}