110,533
社区成员
发帖
与我相关
我的任务
分享
string connstr = "Provider=OraOLEDB.Oracle;Server=localhost;Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = orcl)));User ID=sczl;Password=123;";
OleDbConnection conn = new OleDbConnection(connstr);
conn.Open();
string test_sql = "select 1 from dual";
try
{
OleDbCommand cmd = new OleDbCommand(test_sql,conn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw;
}
finally
{
conn.Close();
}