vs2008 c#开发windows窗体程序,怎么连接数据库

2024-11-30 00:42:06
推荐回答(1个)
回答1:

using(OracleConnection Con = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.20)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ora9i.com)));User Id=123;Password=123;"))
{
OracleCommand CmdObj = new OracleCommand(OraCmd, Con);
OracleDataAdapter dataAdapter = new OracleDataAdapter(OraCmd, Con);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);
}

OracleConnection con = new OracleConnection("Data Source=AA;Persist Security Info=True;User ID=123;Password=123;Unicode=True");