我的电脑Windows 2012服务器,64位和oracle 12 c客户端是32位。我也在使用IIS。所有选项都已完成。我可以访问我的Web应用程序并从数据库中获取数据。
但是,当我尝试向数据库添加内容时,它会出错。它不是关于tnsnames,connectionstring。错误是:
Exception Details: Oracle.DataAccess.Client.OracleException:
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[OracleException (0x80004005)] Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable) +1508
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) +51
Oracle.DataAccess.Client.OracleConnection.Open() +5235
BMS.WebForm1.Button1_Click(Object sender, EventArgs e) +92
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9615682
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
这是连接代码
using Oracle.DataAccess.Client;
. . . . .
string oradb = "DATA SOURCE=bms;PASSWORD=training;USER ID=training;";
OracleConnection con = new OracleConnection(oradb);
con.Open();
MyMessageBox("connected!");
con.Close();