This question is locked. New answers and comments are not allowed.
When i add my viewModel as a resource to a view (usercontrol) i get the following error - any advice on the matter would be awsome. (I'm in a learning process of MVVM and WPF using ORM so any help would be great). Thank you.
A connection string was referenced by name 'myConnection' but could not be resolved through the web.config or the executables app.config file.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(String url, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()
6 Answers, 1 is accepted
0
Sam Ur
Top achievements
Rank 2
answered on 15 Feb 2011, 11:25 AM
I guess i solved the issue.
0
Hello Sam Ur,
Serge
the Telerik team
I am glad that you found the solution to your problem. The issue you experienced was most probably caused by the executing application not having the necessary connection string in its config file.
Again I am glad you found the solution to your problem.
Serge
the Telerik team
0
Sam Ur
Top achievements
Rank 2
answered on 18 Feb 2011, 11:22 AM
Well actually it did have the necessary connection string and in runtime it works but in design time i get the mentioned error.
The problem occurs when i (I used car rental project for orm and wpf) call the following code in constructor...
But in runtime code get's executed as it should.
So basically if i try to fill observ. collection by calling a method that returns some data from model mentioned warning (error) occurs.
I solved this issue by using construtor as written in sample by Telerik :
And then used a trigger to listen to loaded event and fill my obsr. collection. That did the trick.
The problem occurs when i (I used car rental project for orm and wpf) call the following code in constructor...
...
public CarViewModel()
{
this.dataModel = new Models.CarModel();
this.Brand = "WV";
this.Cars = new ObservableCollection<
Car
>(dataModel.LoadCarsByMake(this.Brand));
}
...
But in runtime code get's executed as it should.
So basically if i try to fill observ. collection by calling a method that returns some data from model mentioned warning (error) occurs.
I solved this issue by using construtor as written in sample by Telerik :
public CarViewModel()
{
this.dataModel = new Models.CarModel();
this.Cars = new ObservableCollection<
Car
>();
this.Brand = "WV";
}
And then used a trigger to listen to loaded event and fill my obsr. collection. That did the trick.
0
Hello Sam Ur,
Serge
the Telerik team
Thank you for sharing your solution with us. This will most certainly help others if they stumble upon the same problem as you did.
Please be sure to let us know if you face further trouble.
Serge
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Mehdi
Top achievements
Rank 1
answered on 07 Jan 2013, 10:22 AM
this problem usually cause when two project have used in a solution. one for models and the other for your application.
solution:
the current connection string is in the library class(app.config).
you have to declare the connection string with the same name as library project connection Name in configuration file in your application .
thanks.
solution:
the current connection string is in the library class(app.config).
you have to declare the connection string with the same name as library project connection Name in configuration file in your application .
thanks.
0
Mehdi
Top achievements
Rank 1
answered on 07 Jan 2013, 10:47 AM
this problem usually cause when two project have used in a solution. one for models and the other for your application.
solution:
the current connection string is in the library class(app.config).
you have to declare the connection string with the same name as library project connection Name in configuration file in your application .
thanks.
solution:
the current connection string is in the library class(app.config).
you have to declare the connection string with the same name as library project connection Name in configuration file in your application .
thanks.