3个回答
展开全部
没有用这样的。我喜欢用app.config写连接字符串
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Oracle
ODBC
New version:
"Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;"
Old version:
"Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;"
OLE DB, OleDbConnection (.NET)
Standard security:
"Provider=msdaora;Data Source= MyOracleDB;UserId=UserName;Password=asdasd;"
This one's from Microsoft, the following are from Oracle
Standard Security:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"
Trusted Connection:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
OracleConnection (.NET)
Standard:
"Data Source=Oracle8i;Integrated Security=yes";
This one works only with Oracle 8i release 3 or later
Declare the OracleConnection:
C#:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "my connectionstring";
oOracleConn.Open();
ODBC
New version:
"Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;"
Old version:
"Driver={Microsoft ODBC Driver for Oracle};ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;"
OLE DB, OleDbConnection (.NET)
Standard security:
"Provider=msdaora;Data Source= MyOracleDB;UserId=UserName;Password=asdasd;"
This one's from Microsoft, the following are from Oracle
Standard Security:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"
Trusted Connection:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;OSAuthent=1;"
OracleConnection (.NET)
Standard:
"Data Source=Oracle8i;Integrated Security=yes";
This one works only with Oracle 8i release 3 or later
Declare the OracleConnection:
C#:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "my connectionstring";
oOracleConn.Open();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
专业做法:
可以将connstring写进web.config里面调用
代码=====================================
string connstring="Data Source=instancename;user id=username;password=password";
string cmdstring = "insert into testtable(name) values('haha')";
OracleConnection connection = new OracleConnection(connstring);
OracleCommand myOracleCommand = new OracleCommand(cmdstring, connection);
connection.Open();
myOracleCommand.ExecuteNonQuery();
connection.Close();
//===================================
可以将connstring写进web.config里面调用
代码=====================================
string connstring="Data Source=instancename;user id=username;password=password";
string cmdstring = "insert into testtable(name) values('haha')";
OracleConnection connection = new OracleConnection(connstring);
OracleCommand myOracleCommand = new OracleCommand(cmdstring, connection);
connection.Open();
myOracleCommand.ExecuteNonQuery();
connection.Close();
//===================================
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询