.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
SP
Sambanthamoorthy
Swati Kadam
rosgeppe
Post New Web Links

Activation error occured while trying to get instance of type Database, key "DBName"

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<connectionStrings>
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"
providerName="System.Data.SqlClient

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />
</connectionStrings>


Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)


Database myDB=EnterpriseLibraryCo


View Complete Post


More Related Resource Links

Activation error occured while trying to get instance of type Database, key "DBName"

  

Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<connectionStrings>
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"
providerName="System.Data.SqlClient

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />
</connectionStrings>


Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)


Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>("MYCON2"); --> Error message, see below


Activation e

using EnterpriseLibrary.Data gives error as "Activation error occured while trying to get instance o

  

Hi,

I am using the "Microsoft.Practices.EnterpriseLibrary.Data" version "5.0.414.0". I am using VS 2010.

I have added connectionstring entry in the web.config, and I am able to access the database using SQL Server 2008 R2.

I have added the below line in my code to use the database:

 

using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;

public class A1
{
public DataSet GetTableData()
{
Database db = null;
db = DatabaseFactory.CreateDatabase("Connection String Name");
}
}

However, I am getting an error as:

"Activation error occured while trying to get instance of type Database, key". It breaks in CreateDatabase line.

How to fix this?

Thank you


Sudden Error: Could not load type System.ServiceModel.Activation.HttpModule - Urgent Help Please

  
hi,

I have a windows 7 machine with IIS 7. I was hosting WCF services on IIS normally and i had a couple of services running.
Suddenly (i honestly did not do any configuration changes on my machine) all these services stopped working. When i try to browse the .svc file i get the following error:


"Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

Just in case this information is helpful, all these services are running on the basicHttpBinding.

Please help!

How to resolve this error? - Database on SQL Server instance is not empty and does not match current

  
Upgrade form MOSS 2007 to Sharepoint 2010.  Reviewing the event log I see the following error.  Not sure what to do and hoping someone can provide some guidance please.

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name

Enterprise Library 5.0 Activation error occured

  

Hi,

       I am using Enterprise Library 5.0,when am run the console application ,i got this error " Activation error occured while trying to get instance of type Database,key 'xxx' ".

 

Thanks

Deivendran


An error occured during local report processing. Exception of type 'System.OutOfMemoryException' W

  

I've been getting this error, randomly when previewing two reports.

It does not seem to be based on report complexity, size, subreports etc. When
reports are deployed to server, they all run fine. I just get the out of memory error locally.

1. I have one version with 2 datasets, and a number of matrix, table and list data regions.
2. I have a second version with only one table data region.
3. There is no custom code, variables, prompts or generally anything other than basic
formatting in the report.
4. Both reports are based on the same SQL table.

I can seem to run the two reports (both based on same SQL table) a few times, and
then they start giving the out of memory error.

I can open other other reports and they preview fine locally.

What I've tried so far to no avail:

1. Deleted the downloaded data before refreshing the two reports.
2. Tried building the two reports before running.
3. Tried changing the process priority to high for devenv.exe.
4. Removed filters in the reports.
5. Changed the physical order of the underlying table.
6. Closed the reports and then re-opened them.
7. Close Visual Studio and Re-Open. This seems to work for a while and then the two
reports start giving the error messages again.
8. Cop

Type or namespace error.

  

A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 



Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.


I can eliminate the error by adding an

<add

ERROR [HY000] [Informix .NET provider][Informix]Database locale information mismatch

  

Hi, there is an upgrade to my infimacs server and my web application encounter this error after the infimacs is upgraded.

Below is the information on the server before/after the upgrade.

Before            After

---------       -----------  

Solaris 8      Solaris 10

IDS 9.40     IDS 11.50


The web server where the web application hosted is running IBM Informix Connect 2.81. There is no such error before the upgrade is done.

As a developer, i have IBM Informix Client-SDK 2.90 installed on my local pc and debug the page where the read is needed from infimacs but no such error found.

The error come out only when it is hosted on the web server where IBM Informix Connect 2.81 is installed.

I have gone through many articles and it suggest me to set the environement  variable in the server :  DB_LOCALE=en_us.819.

I haven't try this solution but i think that this might not be the best solution.

Is it possible to to to have this settin

"Type ASP.x is not defined" error for dynamic user control when publishing updateable

  

I have a user control (ContainerCtrl) which programmatically instantiates another user control (SimpleCtrl) in OnLoad. It builds and runs fine, but when I publish it I get the error "error BC30002: Type 'ASP.SimpleCtrl' is not defined." (If I publish without the "updateable" option there's no error, but I need the site to be updateable.)

I assume this has to do with the particulars of how the assembly(ies) are built for the different compiler options. My question is, how can I get it to work properly for "updateable" publishing?

VS 2008 / .NET 3.5 sp1

The code follows (web.config is the default from Visual Studio).

Many thanks, Dave

SimpleCtrl.aspx------------------------------

<%@ Control Language="VB" ClassName="SimpleCtrl" CodeFile="SimpleCtrl.ascx.vb" Inherits="_SimpleCtrl" %>

<div>
    Simple control
</div>

SimpleCtrl.aspx.vb------------------------------

Partial Class _SimpleCtrl
    Inherits UserControl

    'Nothing to see here.

End Class

ContainerCtrl.aspx------------------------------

<%@ Control Language="VB" CodeFile="ContainerCtrl.ascx.vb" Inherits="_ContainerCtrl"

Parser Error Message: Could not load type MasterPage File

  

 

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'wamsilverlight.Web.Wam'.

Source Error:

Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Wam.master.cs" Inherits="wamsilverlight.Web.Wam" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Source File: /Wam.Master    Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927

 

All of the following have been tried over and over again:

1.) Delete all existing .dlls

2.) Delete MasterPage File and recreate it.

3.) Delete MasterPage perform a c

override error message (The value 'test' is not valid for Age) when input incorrect data type for in

  

Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.


public class Person
{
public string FirstName {get;set;}
public int Age {get;set;}

}

For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.


Error converting data type varchar to numeric.

  

I create a form to record data using ASP.NET and SQL database...
when i run the project show error "Error converting data type varchar to numeric"

what's the problem actually.i try to change in datatype in database..
but still showing error...


Thanks


Error "user does not have permission to perform this operation" with User Instance = True.

  

I setup SQL Server 2005 / SQL Express. All works fine in SQL Server 2005.

I am connecting to a SQL Database from VS 2005,  Tools/Connect to Database. I set the Data Source to "Microsoft SQL Server Database File (SqlClient)" (meaning SQL Server Express) and User Instance = True, and Integrated Security = True.

The above is working successfully on all machines except my Laptop. On my Laptop, I am getting this error "user does not have permission to perform this operation". On my Laptop, if I change User Instance = False, it works fine. Also, If I connect to SQL Server 2005 it works fine only if User Instance = False.

I tried all kind of security changes, nothing worked. For example, I setup Everyone as Full Control for the Folder and the MDF File of SQL Server. I gave my user ID as sysadmin role in SQL Server Express. Also, I enabled creating User Instance form SQL Server Express, Nothing is working.

Appreciate your help.

Tarek.


"An error occurred while retrieving data from Oracle Instance..."

  

I have succeffuly Imported the ADF and have also successfully created a Business Data Column. But when I try to query data , I get the following error

An error occurred while retrieving data from Oracle Instance. Administrator, see the server log for more information

And this is what I found in the Application Logs
A Metadata Exception was constructed in App Domain '/LM/W3SVC/81256521/ROOT-1-129217212004078822'. The full exception text is: LobSystem could not be found using criteria 'id=476'.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend