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

2024年11月30日 00:42
有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");