connection-string

Reading connection string from external config file

我们两清 提交于 2019-12-18 04:40:34
问题 I have created a console application and an app.config file and Connections.config file. The app.config file has a connectionstring property source pointing to the Connections.config When I tried to read the connection string in the application, I get a ConfigurationErrorException This is my main method. static void Main(string[] args) { var settings = ConfigurationManager.ConnectionStrings; if (settings != null) { foreach (ConnectionStringSettings setting in settings) { Console.WriteLine

ADODB Connection String: Workgroup Information file is Missing?

别等时光非礼了梦想. 提交于 2019-12-18 04:17:27
问题 I have a few data sources in access that I need to connect to programatically to do things with behind the scenes and keep visibility away from users. Said datasource has a password 'pass' as I'm going to call it here. Using this connection method I get an error attempting to use the open method Dim conn as ADODB.Connection Set ROBBERS.conn = New ADODB.Connection conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _ & "Jet

EF 5.0 & dynamic connection string?

一曲冷凌霜 提交于 2019-12-18 04:09:47
问题 One thing is driving me crazy right now. My (Database-first) EF-Model needs a dynamic connection string (IP-Adress of Server might change once in a while). So in older EF-Versions you could pass a connection-string via constructor, but that is not possible in 5.0 as is seems. What I have read so far, you could change your datatemplate, but that will be overwritten each time you re-generate your model etc., so not the best way to do it. Another thing is the SQLConnectionFactory, but that does

What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string?

末鹿安然 提交于 2019-12-18 03:56:38
问题 What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string. Min Pool Size=[max size ?] Max Pool Size=[min size] 回答1: There is no documented limit on Max Pool Size. There is however an exact documented limit on maximum number of concurrent connections to a single SQL Server (32767 per instance, see http://msdn.microsoft.com/en-us/library/ms143432(v=SQL.90).aspx). A single ADO.NET pool can only go to a single instance, so maximum effective limit is

Encrypt and deploy app.config

回眸只為那壹抹淺笑 提交于 2019-12-17 23:07:20
问题 I read and tested a lot to find the best practice to encrypt and deploy an app.config to different machines. In general, I would like to secure the content of the connection string from third parties and deploy the application to different machines. I will not configure each machine manually. I know there are several ways like: Aspnet_Regiis (RSAProtectedConfigurationProvider, DPAPIProtectedConfigurationProvider) bound to a machine, user or custom. RSA encryption key. System.Security

Entity Framework cant use the DbContext, model being created

江枫思渺然 提交于 2019-12-17 20:57:30
问题 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

MySQL exceptions not caught (C#)

二次信任 提交于 2019-12-17 20:53:30
问题 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",

Share a Connection string between multiple web projects

别说谁变了你拦得住时间么 提交于 2019-12-17 20:14:38
问题 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? 回答1:

How to add Failover Partner to a connection string in VB.NET

主宰稳场 提交于 2019-12-17 19:31:11
问题 I have a windows application connecting to Database to read some data. Since the database is setup for resilience, my application needs to connect to one of the two databases. Can someone specify the what the syntax would be to specify the failover partner in a connection string using sql server authentication. Any help is greatly appreciated. 回答1: Check connectionstrings.com: Database mirroring If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your

What is the default value of IMEX in OLEDB?

一曲冷凌霜 提交于 2019-12-17 19:25:27
问题 string strConn = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" + filename + ";Extended Properties=\"Excel 12.0 Xml;HDR=Yes;IMEX=1\";"; I search on google, and got no results. I think the default value is 2, but I am not sure. Anyone can help me? Thanks. 回答1: Per the article below, IMEX values of 0 and 2 do the same thing; they use ImportMixedTypes=MajorityType. That is the default if you don't specify IMEX=1 in your extended properties. So the default IMEX behavior is MajorityType, and