| | |
To use Data acess application block with web application VS 2008
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 10
Reputation:
Solved Threads: 0
At run time I am getting error requested database does not exist in configuration see at Line 19
string con = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ConnectionString;
In my webconfig i have given required Code in web config
i have even added required DLL....
i also configured the EnterPrise Library
i defined there required connection string
followed steps in given link http://www.datadirect.com/developer/...t-net-daab.pdf.
but of no result ..
can some one tell me
string con = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ConnectionString;
ASP.NET Syntax (Toggle Plain Text)
Line 19: Database db = DatabaseFactory.CreateDatabase(con); Line 20: string sqlcmd = "select * from Movies where MovieID<500"; Line 21: DbCommand dbcommand = db.GetSqlStringCommand(sqlcmd);
In my webconfig i have given required Code in web config
ASP.NET Syntax (Toggle Plain Text)
<configSections><section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/></configSections> <connectionStrings><add name="AdventureWorksDB" providerName="System.Data.SqlClient" connectionString="server=localhost;database=AdventureWorks;UID=user;PWD=word;"/><connectionStrings> <dataConfiguration defaultDatabase="AdventureWorksDB"/>
i have even added required DLL....
i also configured the EnterPrise Library
i defined there required connection string
followed steps in given link http://www.datadirect.com/developer/...t-net-daab.pdf.
but of no result ..
can some one tell me
Last edited by peter_budo; Dec 18th, 2008 at 3:29 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 1
your problem is here :
string con = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ConnectionString;
you have no connection string with name "cn" your connection string is called AdventureWorksDB this mean you have to write :
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["AdventureWorksDB "].ConnectionString;
string con = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["cn"].ConnectionString;
you have no connection string with name "cn" your connection string is called AdventureWorksDB this mean you have to write :
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["AdventureWorksDB "].ConnectionString;
•
•
Join Date: Dec 2008
Posts: 8
Reputation:
Solved Threads: 1
ok the second problem can be also in your web.config declaration. you have to different database but I'm not sure because I never used dataConfiguration tag. Hope this will solve your problem.
<connectionStrings><add name="AdventureWorksDB" providerName="System.Data.SqlClient" connectionString="server=localhost;database=AdventureWorks;UID=user;PWD=word;"/><connectionStrings> <dataConfiguration defaultDatabase="AdventureWorksDB"/>
Last edited by peter_budo; Dec 18th, 2008 at 3:30 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: IIS
- Next Thread: asp.net localization using .resx files
Views: 973 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn chat checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





