SF BO throws DataAccessLayerException when Accessed any method of the BusinessObject.


SF BO throws DataAccessLayerException when Accessed any method of the...
Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I try to use 2 sql databases, but cannot make it work



Private Shared Sub SetDataSources()

'------------------------------------

' Using the Connection Manager

'------------------------------------



'-- Set the information specific to this application and the data sources

' The application key:

ConnectionManager.ApplicationKey = "Integra4"

ConnectionManager.ApplicationDefaultTitle = "Integra4"

ConnectionManager.ApplicationDefaultDescription = "conexion de Integra4"



'ConnectionManager.ShowAvailableConnectionStrings()



'-- Set the required data source information so that the ConnectionManager can gather it

' SQL Connection



'i4net

ConnectionManager.AddRequiredDataSourceItem("I4", "SQL Connection", _

DataSourceTypeOptions.SqlServer, "I4NET", "This connection is used by INTEGRA4.")



'Integra4Config

ConnectionManager.AddRequiredDataSourceItem("I4CONFIG", "SQL Connection", _

DataSourceTypeOptions.SqlServer, "Integra4Config", "Conexion a integra4Config")



ConnectionManager.SetConnections()



'-- ToDo: Set the data source key for the security tables

SecurityBasics.SecurityDataSourceKey = "I4"

End Sub



note: I try DataLayer.DataSources.Add(New SqlDataSourceItem("", "myconnectionstring")) but when I create a BO with a datasourcekey "integra4config" and make a fill, only a innerexception "The DataSourceKey [I4CONFIG] is not defined." appears



I Cannot set 2 databases and call 2 BOs with diferent datasourcekeys



Any help please?? thanks



- Fabian
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The problem is in the AddRequiredDataSourceItem() line.  The first parameter is the DataSourceKey for the data source your requiring.  It's basically a unique key for the connection string that will be created at runtime.  That value must match the DataSourceKey property on each business object that will use that connection string.  So, the business objects' DataSourceKey property defaults to an empty string (""), so either, you need to change that first parameter to an empty string, or you need to change the DataSourceKey property on your business objects to be "ISOCOM Key".
Vikram Saxena
Vikram Saxena
StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)
Group: Forum Members
Posts: 41, Visits: 99
Dear All,

i am using Starta Frame on my machine. everything is running quite well on machine. Our one more developer is also working on the same project as i am. but when he started the project on his machine a DataAccessLayer Exception is being thrown on his machine with the message that "An error occurred whuke creating a new DataLayer for the Business object." The inner exception is null. The other information i found for exception is "DataSourceKey [] is not defined."

please tell me whats the wrong happening here?

my code is in C# and SetDataSource event handler for the StartaFrame.SetDataSource event is as follows (present in program.cs)

static void StrataFrameApplication_SetDataSources()

{

ConnectionManager.ApplicationKey = "ISOCOM Key";

ConnectionManager.ApplicationDefaultTitle = "ISOCOM Connection";

ConnectionManager.ApplicationDefaultDescription = "This application connection is used by ISOCOM";

// Set the required data source information so that the ConnectionManager can gather it

// SQL Connection

ConnectionManager.AddRequiredDataSourceItem("ISOCOM Key", "SQL Connection", DataSourceTypeOptions.SqlServer, "ISOCOM", "This connection is used by MyApplication.", true);

////SQL Connection

//// Make the call to SetConnections which will gather the connection information, show the connection wizard

//// if needed and set the DataSources collection on the DataLayer class.

ConnectionManager.SetConnections();

}


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search