连接Oracle时出错,请帮忙看看.
我在asp.net中用下面代码访问Oracle数据库时出现如下错误:
Server Error in '/NewNet' Application.
--------------------------------------------------------------------------------
Unable to load DLL (oci.dll).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.DllNotFoundException: Unable to load DLL (oci.dll).
Source Error:
Line 111: OracleConnection conn=new OracleConnection();
Line 112: conn.ConnectionString = "user id=Tim;data source=timdb;password=aspcool;";
Line 113: conn.Open();
Line 114: string sSql = "select * from THREADS";
Line 115: OracleCommand comm=new OracleCommand(sSql,conn);
Source File: g:\wwwroot\newnet\login.aspx.cs Line: 113
Stack Trace:
[DllNotFoundException: Unable to load DLL (oci.dll).]
System.Data.OracleClient.DBObjectPool.GetObject(Object owningObject, Boolean& isInTransaction)
System.Data.OracleClient.OracleConnectionPoolManager.GetPooledConnection(String encryptedConnectionString, OracleConnectionString options, OracleConnection owningObject, Boolean& isInTransaction)
System.Data.OracleClient.OracleConnection.OpenInternal(OracleConnectionString parsedConnectionString, Object transact)
System.Data.OracleClient.OracleConnection.Open()
NewNet.Login.btnLogin_Click(Object sender, EventArgs e) in g:\wwwroot\newnet\login.aspx.cs:113
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
我在winform中用同样得代码时正确得,但是在asp.net中却不行,我想可能是asp.net得访问权限不够,请大虾指点解决方法,不甚感激.代码如下:
OracleConnection conn=new OracleConnection();
conn.ConnectionString = "user id=Tim;data source=timdb;password=aspcool;";
conn.Open();
string sSql = "select * from THREADS";
OracleCommand comm=new OracleCommand(sSql,conn);
OracleDataReader reader=comm.ExecuteReader();
Response.Write(reader.GetInt32(0));
conn.Close();
Response.End();