connection-string

The connection string 'MyConnection' in the application's configuration file does not contain the required providerName attribute.\"

浪尽此生 提交于 2019-11-28 18:30:39
I use Entity Framework Code First , My connection string is in a configuration file: <connectionStrings> <clear/> <add name="ApplicationServices" connectionString="Data Source=PC-X;Initial Catalog=MYdb;Integrated Security=True"/> </connectionStrings> When I try to access the data (something that should create the DB) is falling with the following error: The connection string 'ApplicationServices' in the application's configuration file does not contain the required providerName attribute." What am I missing? You're missing the following piece of code after the connectionString attribute

Point to localhost\\sqlexpress using only localhost

青春壹個敷衍的年華 提交于 2019-11-28 17:15:58
Working on a common codebase, one developer is running SQL Server Express 2005 and the other 2 are running SQL Server 2005. Everything is working fine, but the connection strings differ. To maintain common configuration and build scripts we're looking to mask "localhost\sqlexpress" to just "localhost" like the other 2 developers. Can this be done? Or, maybe there's a better way for all 3 to run on the same connection string... The solution sought is for all 3 to be able to run on the same file versions in the code repository. I might not be 100% clear: basically I want this: Data Source

How should I edit an Entity Framework connection string?

痴心易碎 提交于 2019-11-28 16:16:22
I recently had to edit my app.config file to change the connection string for an Entity Framework data model ( .edmx file). But I'd like to know: Is there a way to edit the EF connection string using the designer? The original connection string is auto-generated by the Entity Data Model wizard. The connection string then cannot be changed - it remains disabled in the properties window of the .edmx designer. I like to avoid editing XML by hand if I can (in app.config), so I was wondering if there is a way to get back into the original wizard screen to make connection string changes and let the

What is the difference between Trusted_Connection and Integrated Security in a connection string?

点点圈 提交于 2019-11-28 15:55:06
问题 I'm curious what the difference between the token "Trusted_Connection" and "Integrated Security" in SQL Server connection strings (I believe other databases/drivers don't support these). I understand that they are equivilent. 回答1: They are synonyms for each other and can be used interchangeably. In .Net, there is a class called SqlConnectionStringBuilder that is very useful for dealing with SQL Server connection strings using type-safe properties to build up parts of the string. This class

MySQL exceptions not caught (C#)

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 14:03:06
My C# program works with a MySQL database. For some reason the program cannot catch exceptions caused my the MySQL connection. Example: If I make the credentials in the connection string invalid, the program crashes like this (even when running in the debugger): http://imgur.com/SfzkVdW The connection code is like this: using MySQLDriverCS; namespace XXX { public class Data { private static MySQLConnection con; static Data() { string connectionString = new MySQLConnectionString("XXX", "XXX", "XXX", "XXX").AsString; con = new MySQLConnection(connectionString + ";CharSet=utf8"); con.Open(); //

Persist Security Info Property=true and Persist Security Info Property=false

99封情书 提交于 2019-11-28 13:15:56
For the properties: Persist Security Info=true and Persist Security Info=false Can you tell me what is the difference between them, and if I don't put it in my connection what will happen? connect.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:/Users/Nourah/Downloads /Phase3/Salary.accdb; Persist Security Info=False;"; Even if you set Persist Security Info= true OR Persist Security Info=false it won't show a difference in front..The difference is happening at background When Persist Security Info set to false security-sensitive information, such as the password, is not

Share a Connection string between multiple web projects

一笑奈何 提交于 2019-11-28 12:34:17
OK I have two web projects WebProject1 & WebProject2. Both require database connectivity so this is all in a C#.NET project called Common. Now my question is currently the connection string for both is the same and at the moment it's hard coded into the DB class (In the Common project), but I want to move it out to a config file. I would really like to have a config file in the Common project with the connection string in which both web projects then use. Is this possible, and if so how? There's a few ways you could do it: put common configuration settings in machine.config as shown here put

Retrieve and use Windows Azure's connection strings?

走远了吗. 提交于 2019-11-28 12:15:37
I've configured connection strings in Azure management portal Configure->Connection Strings (linked resources): What are these connection strings useful for? I tried deleting the conn. strings from web.config file, so it should read from here, but it doesn't. Is there any other way? Basically I want these connection strings to override the connection strings in web.config to be used in production environment. I've added the following to the Application_Start method: var sb = new StringBuilder(); var appConfig = ConfigurationManager.OpenMachineConfiguration(); foreach (ConnectionStringSettings

ConnectionString For Getting An Excel File Problem

偶尔善良 提交于 2019-11-28 12:06:12
问题 in have an Excel File Named (a.xlsx) in A Folder Named (ExcelFiles). the ExcelFiles Folder Is located in the root Of my project. so my connection string for getting excel file data is like this : <add name="xlsx" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=aaa\ExcelFiles\a.xlsx;Extended Properties=Excel 12.0"/> aaa = My Project Name with this connection string every thing is ok in local , but after upload web site i have an error. where is the problem?? is this path true -

Entity Framework cant use the DbContext, model being created

霸气de小男生 提交于 2019-11-28 12:06:00
I am using EF 4.1, and I create a normal EF edmx file. I generate it from a DB. When it's been generated I rightclick and select add code generation item, to generate new classes, and use the DbContext instead. I use the template DbContext generator. Everything works fine. Then I trie to query the context: using (var context = new PasDBEntities()) { var client=context.ClientCompanies.SingleOrDefault(_=>_.ID==clientCompanyId); if(client!=null) I have no problem creating a new instance of the context but when I try to query it the problem occur. I get stuck on the UnintentionalCodeFirstException