p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional ASP.NET 4 : in C# and VB (http://p2p.wrox.com/book-professional-asp-net-4-c-vb-554/)
-   -   Keyword not supported: 'provider' (http://p2p.wrox.com/book-professional-asp-net-4-c-vb/86475-keyword-not-supported-provider.html)

Flyby09 January 27th, 2012 12:44 PM

Keyword not supported: 'provider'
 
Hi,

If this is a novice question, I apologize, but I need to post my question on both the Beginner and Professional books, since I do not know which category it belongs to.

Currently, I am trying to use Oracle database for a Web application inside .NET framework. Between this book and its cousin Beginner one, I hope to find some quick help as what I need to add to my Web.config or how to configure my laptop so that .NET will see tables/views/etc. from a remote Oracle DB. I would appreciate any pointer to my issue.

Thank you in advance for your help.

In my Web.config, I have this line in the connectionStrings collection element:
<add name="IMCX" connectionString="Provider=MSDAORA;Data Source=imacs_imcx;Persist Security Info=True;Password=<I-put-my-password-here>;User ID=<I-put-my-Oracle-logon-ID-here>" providerName="System.Data.OleDb" />

In my C# code:
SqlConnection DBCon;
DBCon.ConnectionString = ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString;

Here is the stacktrace
Keyword not supported: 'provider'.
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.ArgumentException: Keyword not supported: 'provider'.

Source Error:


Line 29: System.Threading.WaitHandle[] WHandles = new System.Threading.WaitHandle[2];
Line 30: DBCon = new SqlConnection();
Line 31: DBCon.ConnectionString = ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString;
Line 32: UsersCommand.CommandText = "SELECT VUSER FROM WDS49.KWRD_TABLE WHERE GROUP_PASS like '"
Line 33: + profile.ToUpper()


Source File: c:\Users\...\Documents\Visual Studio 2010\WebSites\Gina2\kwrd.aspx.cs Line: 31

Stack Trace:


[ArgumentException: Keyword not supported: 'provider'.]
System.Data.Common.DbConnectionOptions.ParseIntern al(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5096356
System.Data.Common.DbConnectionOptions..ctor(Strin g connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(St ring connectionString) +64
System.Data.SqlClient.SqlConnectionFactory.CreateC onnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetCo nnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionStri ng_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_Connection String(String value) +4
kwrd.GetKeywordProfile(String profile) in c:\Users\...\Documents\Visual Studio 2010\WebSites\Gina2\kwrd.aspx.cs:31
kwrd.Page_Load(Object sender, EventArgs e) in c:\Users\...\Documents\Visual Studio 2010\WebSites\Gina2\kwrd.aspx.cs:18
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

irProject February 14th, 2012 04:15 PM

Quote:

Originally Posted by Flyby09 (Post 280795)
<add name="IMCX" connectionString="Provider=MSDAORA;Data Source=imacs_imcx;Persist Security Info=True;Password=<I-put-my-password-here>;User ID=<I-put-my-Oracle-logon-ID-here>" providerName="System.Data.OleDb" />

In my C# code:
SqlConnection DBCon;
DBCon.ConnectionString = ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString;

as you mentioned you are using System.Data.OleDb provider, so in your C# code you should write:

Code:

OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString);


also see
http://www.connectionstrings.com/oracle#p20
and then try:
Code:

OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString);
also you can change connection string and then try
(http://www.connectionstrings.com/oracle#p19)
Code:

System.Data.OracleClient.OracleConnection conn;
conn.ConnectionString = ConfigurationManager.ConnectionStrings["IMCX"].ConnectionString);



All times are GMT -4. The time now is 01:52 PM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.