美好的一天!我試圖插入只是一個單一領域的實體在Oracle數據庫中的表,但我有這個錯誤在我的堆棧跟蹤:使用ASP.Net插入命令應用於ORACLE數據庫表
**Stack Trace**:
[OracleException(0x80131938):ORA-12154:TNS :無法解析指定的連接標識 ] System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle,Int32 rc)+338968 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName,String password,String serverName,Boolean integratedSecurity,布爾unicode,布爾omitOracleConnectionName)+879 System.Data.OracleClient.OracleInternalConnection ..ctor(OracleConnecti onString connectionOptions)+129 System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions選項,對象poolGroupProviderInfo,池類DBConnectionPool,的DbConnection owningObject)+ 40 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(的DbConnection owningConnection,池類DBConnectionPool,DbConnectionOptions選項) 31 System.Data.ProviderBase.DbConnectionPool.CreateObject(的DbConnection owningObject)548 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(的DbConnection owningObject)69 System.Data.ProviderBase.DbConnectionPool.GetConnection(的DbConnection owningObject)470 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)+108 System.Data.ProviderBase.DbConnectionClos ed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)+118 System.Data.OracleClient.OracleConnection.Open()+43 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand命令,DataSourceOperation操作)+378 系統。 Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values)+399 System.Web.UI.WebControls.SqlDataSource.Insert()+19 E:\ Documents \中的ASP.jtrap_import_aspx.InsertWeight(Object Source,EventArgs e) Visual Studio 2013 \ Projects \ jTRAP_net v1 \ jTRAP_net \ jTRAP_import.aspx:12 System.Web.UI.WebControls.Button.OnClick(EventArgs e)+9628722 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103 System.Web.UI.WebControls.Button.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(字符串eventArgument)10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,字符串eventArgument)13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection中POSTDATA)35 的System.Web。 UI.Page.ProcessRequestMain(布爾includeStagesBeforeAsyncPoint,布爾includeStagesAfterAsyncPoint)1724
這是我數據源:
<asp:Sqldatasource
ID="OracleServer1" Runat="server"
ConnectionString="Data Source=OracleServer1;Persist Security Info=True;"
ProviderName="System.Data.OracleClient"
InsertCommand="INSERT INTO tbl_object(WEIGHT) VALUES(@Weigh)">
<insertparameters>
<asp:formparameter name="Weigh" formfield="TextBox1" />
</insertparameters>
</asp:Sqldatasource>
這裏是我的connectio ñ串位於我的web.config:
<connectionStrings>
<add name="OracleConnectionString"
connectionString="Data Source=OracleServer1;Persist
Security Info=True;"
providerName="System.Data.OracleClient"
/>
您的幫助,將不勝感激!
那麼,你的連接字符串不匹配你的機器上的TNS條目。在嘗試使用OracleServer1時會發生什麼? – OldProgrammer