内蒙古 其他
IT茶座,IT公司查询    
[搜索] [Google 站内搜索] 添加新公司    
连接到oracle数据库(一)
using System;
using System.Data;
using System.Data.ADO;

class OracleTest
{
static void Main()
{


//UID - User Id
//PWD - Password
//Server - Your Service name
//Using Microsoft ODBC for Oracle DSN-Less
//const string strConn = "Provider=MSDASQL;DRIVER={Microsoft
ODBC for ORACLE};UID=scott;PWD=tiger;Server=fnqa";

//Using Microsoft OLEDB Provider for Oracle
const string strConn = "Provider=MSDAORA.1;Data
Source=oracle_db;User ID=scott;Password=tiger";

//Using DSN Connection
//const string strConn =
"DSN=oracle_dsn;UID=scott;PWD=tiger" ;
const string strSQL = "Select * From EMP";

try
{
DataSet ds = new DataSet("EmployeesSet");
ADODataSetCommand myCommand = new
ADODataSetCommand(strSQL,strConn);
myCommand.FillDataSet(ds,"Buyer");
Console.WriteLine(ds.XML);
}
catch(ADOException e)
{
Console.WriteLine("Exception Occured :
{0}",e.Errors[0].Message);
}


}
}  

阅读:
录入:

关于我们 | 联系我们 | 服务条款 | 帮助中心 | 公司评论 | 会员注册
沪ICP证041070号 Copyright©2007 ITCups All rights Reserved