Use ASP.Net insert command to apply on an ORACLE database table -
good day! i'm trying insert entity single field in oracle database table i'm having error in stack trace:
**stack trace**:
[oracleexception (0x80131938): ora-12154: tns:could not resolve connect identifier specified ] system.data.oracleclient.oracleexception.check(ocierrorhandle errorhandle, int32 rc) +338968 system.data.oracleclient.oracleinternalconnection.openonlocaltransaction(string username, string password, string servername, boolean integratedsecurity, boolean unicode, boolean omitoracleconnectionname) +879 system.data.oracleclient.oracleinternalconnection..ctor(oracleconnectionstring connectionoptions) +129 system.data.oracleclient.oracleconnectionfactory.createconnection(dbconnectionoptions options, object poolgroupproviderinfo, dbconnectionpool pool, dbconnection owningobject) +40 system.data.providerbase.dbconnectionfactory.createpooledconnection(dbconnection owningconnection, dbconnectionpool pool, dbconnectionoptions options) +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.dbconnectionclosed.openconnection(dbconnection outerconnection, dbconnectionfactory connectionfactory) +118 system.data.oracleclient.oracleconnection.open() +43 system.web.ui.webcontrols.sqldatasourceview.executedbcommand(dbcommand command, datasourceoperation operation) +378 system.web.ui.webcontrols.sqldatasourceview.executeinsert(idictionary values) +399 system.web.ui.webcontrols.sqldatasource.insert() +19 asp.jtrap_import_aspx.insertweight(object source, eventargs e) in e:\documents\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(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
here data source:
<asp:sqldatasource id="oracleserver1" runat="server" connectionstring="data source=oracleserver1;persist security info=true;" providername="system.data.oracleclient" insertcommand="insert tbl_object(weight) values(@weigh)"> <insertparameters> <asp:formparameter name="weigh" formfield="textbox1" /> </insertparameters> </asp:sqldatasource>
and here connection string located in web.config:
<connectionstrings> <add name="oracleconnectionstring" connectionstring="data source=oracleserver1;persist security info=true;" providername="system.data.oracleclient" />
your appreciated!
i've made better choice of doing in code behind i'm more familiar w/ method , made work:
code behind:
dim strconnection string = configurationmanager.connectionstrings("oracleconnectionstring").connectionstring dim oracleconnection new oracle.dataaccess.client.oracleconnection(strconnection) if oracleconnection.state = connectionstate.closed msgbox("opening oracle connection") oracleconnection.open() msgbox("oracle connection opened.") end if dim strquery string = "insert ......(so on)" dim oraclecommand new oraclecommand(strquery, oracleconnection) msgbox("inserting values table") oraclecommand.executenonquery() msgbox("successfully inserted values table")
and here's connection string code in web.config file
<connectionstrings> <add name="oracleconnectionstring" connectionstring="data source=localhost;user id=username;password=password" providername="oracle.dataaccess.client" /> </connectionstrings>
Comments
Post a Comment