connection-string

why connection string is not found from my class library to another class library?

不羁的心 提交于 2019-12-23 12:39:01
问题 I am having the architecture like this : Where MVC layer is the presentation layer. EF is class library and Repository is another class library.I am trying to insert data to database from repository by creating the EF context object. Added EF reference into Repository class library. EF having the edmx file. its app.config having the connection string generated by EF. code is : public bool CreateUser(User _user) { context.Users.Add(_user); context.SaveChanges(); return true; } but while

How do I properly set the DataDirectory in a web project connection string?

放肆的年华 提交于 2019-12-23 12:24:17
问题 My solution has a class lib project with a database (my DAL), and a web project to act as a WCF service layer. I add a reference to the DAL project from the web project, and when I compile, my database is copied to the Bin folder of the web project. The Web.config file needs the connection string. If I use: attachdbfilename=|DataDirectory|\Test.mdf it looks for the DB in the App_Data folder. I can easily place a copy of the DB in the App_Data folder, however, at this stage in development I'm

ConnectionString configSource not found when deployed to Azure

喜欢而已 提交于 2019-12-23 11:41:13
问题 I am securing my MVC5 project, by moving the connection strings out of web.config into an external file, and not checking this into source control, nor adding it to the project. My web.config looks like <configuration> <connectionStrings configSource="ConnectionStrings.config" /> This works perfectly in development. I have the website hosted in Azure WebSites, and I have manually defined the connectionstrings in the configuration portal. The problem is that when I publish to Azure, I get the

share connectionstrings with multiple projects in same solution

狂风中的少年 提交于 2019-12-23 09:10:59
问题 I have multiple projects in the same solution. I would like them to share the same connectionStrings so that I don't have to change the this in multiple places. In my web configs I have <connectionStrings configSource="bin/connectionStrings.config" /> and then I have added a file as a link to my "connectionsStrings.config" which sits at the solution level. I have changed the properties so that the "Copy to Output Directory" is "Copy always" and the "Build Action" is "Content" But I get the

Readonly connection string to an access database

一世执手 提交于 2019-12-23 07:16:48
问题 I'm trying to connect to an Access database file using a System.Data.OleDb.OleDbConnection. I need to connect in readonly mode because another application uses it at the same time. I can connect to the database in read/write no problem but can't seem to find anywhere the correct string for readonly. I've tried: Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=False;Mode=Read Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=False;Extended

Readonly connection string to an access database

☆樱花仙子☆ 提交于 2019-12-23 07:14:39
问题 I'm trying to connect to an Access database file using a System.Data.OleDb.OleDbConnection. I need to connect in readonly mode because another application uses it at the same time. I can connect to the database in read/write no problem but can't seem to find anywhere the correct string for readonly. I've tried: Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=False;Mode=Read Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Persist Security Info=False;Extended

How to extract database name from connection string irrespective of RDBMS?

北城以北 提交于 2019-12-23 04:19:29
问题 I am working on the class which is not aware about the RDBMS being used. Of-course, rest of the application is well aware about it. Connection string is input to this class. I need database name. How can I extract database name from connection string irrespective of RDBMS? I read following question: How to get Database Name from Connection String using SqlConnectionStringBuilder Extract properties of sql connection string Following approaches are suggested there: Use Connection String Builder

C# WinForm application - How to save connection string (SQLite)

戏子无情 提交于 2019-12-23 02:58:14
问题 I have a winform app in .NET 4.0 with database (SQLite). I need to add an option for user to be able to change the path to the file containing the database - in short, to change the connection string. I used app.config to save connection string like this: <connectionStrings> <add name="connectionString" connectionString="Data Source=D:\myDatabase.db; FailIfMissing=True; Version=3"/> </connectionStrings> Is there a way to allow user to modify app.config file (it is located in Program Files

Asp.net MVC 4 dynamic connection string

瘦欲@ 提交于 2019-12-23 02:06:27
问题 I am learning Asp.net mvc 4 at work and modifying an asp.net mvc 4 project. Currently, the connection to the database is set in the web.config of each project. The project uses entity framework which I am also still trying to understand (I come from a java Apache Wicket background). What I want to do is have a property file for each environment(local, dev, test, production, etc..) and configure the connectionstring from the property file to use the database connection information affiliated

Creating DbContext with both custom ConnectionString and DbProviderInfo

此生再无相见时 提交于 2019-12-23 01:47:27
问题 We have a plethora of databases all sharing the same schema. They are spread about on a number of SQL Servers, some 2005, some 2008. We are getting an exception when connecting to a 2005 server AFTER having connected to a 2008 server first stating the following: An error occurred while updating the entries. See the inner exception for details. An error occurred while updating the entries. See the inner exception for details. The version of SQL Server in use does not support datatype