欢迎光临
我们一直在努力

建站超值云服务器,限时71元/月
connect to oracle database
submitted by user level date of submission
ravi shankar beginner 05/03/2001

description of the article
a simple program to show connecting to an oracle database.
source code:

/***********************************************************************/
//program name : ado connection to oracle
//description  : a sample program to connect to the oracle database
//created on   : 01 may 2001
//created by   : ravi shankar venkatarajalu
/***********************************************************************/
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);
}

}
}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 »
分享到: 更多 (0)

相关推荐

  • 暂无文章