connection-string

Keyword not supported: 'server'

懵懂的女人 提交于 2019-11-26 14:12:26
问题 I've been trying to edit my connection string for uploading my website to a server. I am not really experienced with this. I got this exception: the Keyword not supported: 'server'. Here is my connection string: <add name="AlBayanEntities" connectionString="Server=xx.xx.xxx.xxx,xxxx;Database=AlBayan;Uid=bayan;Password=xxxxx;" providerName="System.Data.EntityClient" /> I've tried embed this string into my old connection string which works very well locally, but it didn't fit : S 回答1: For

How do I set a connection string config programmatically in .net?

一世执手 提交于 2019-11-26 12:59:04
I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys. I have this piece of code, but unfortunately it throws an exception with "the configuration is read only". ConfigurationManager.ConnectionStrings.Clear(); string connectionString = "Server=myserver;Port=8080;Database=my_db;..."; ConnectionStringSettings connectionStringSettings = new ConnectionStringSettings("MyConnectionStringKey", connectionString); ConfigurationManager.ConnectionStrings.Add(connectionStringSettings); Edit: The problem is that I have existing code that reads

Azure connection string best practices

淺唱寂寞╮ 提交于 2019-11-26 11:56:41
问题 I have an application that I am just migrating to Azure. Currently I use web.config transformation to manage changing the database connecting string dev/staging/prod environments. How is it best to manage these multiple connection strings in Azure? 回答1: In cases where it doesn't matter if the developer can see production credentials, you can use the built-in Visual Studio 10 config transformations. If this is what you're looking for, follow these steps: 1.Navigate to your Azure project folder

How to fix error ::Format of the initialization string does not conform to specification starting at index 0::

。_饼干妹妹 提交于 2019-11-26 11:25:59
问题 I uploaded my site on godaddy shared host. I can access this database from my management studio. I can\'t access this database from my site. I get following error: Format of the initialization string does not conform to specification starting at index 0. My connection string is in web.config and it looks like this: <connectionStrings> <add name=\"mcn\" connectionString=\"Data Source=mydatabase.db.8706856.hostedresource.com; Initial Catalog=mydatabase; User ID=username; Password=xyz;\"

SSIS how to set connection string dynamically from a config file

爱⌒轻易说出口 提交于 2019-11-26 10:56:15
问题 I am using SQL Server Integration Services (SSIS) in SQL Server Business Intelligent Development Studio. I need to do a task that is as follows. I have to read from a source database and put it into a destination flat file. But at the same time the source database should be configurable. That means in the OLEDB Connection Manager, the connection string should change dynamically. This connection string should be taken from a configuration/XML/flat file. I read that I can use variables and

Array Join vs String Concat

自古美人都是妖i 提交于 2019-11-26 10:38:49
问题 Which method is faster? Array Join: var str_to_split = \"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\"; var myarray = str_to_split.split(\",\"); var output=myarray.join(\"\"); String Concat: var str_to_split = \"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\"; var myarray = str_to_split.split(\",\"); var output = \"\"; for (var i = 0, len = myarray.length; i<len; i++){ output += myarray[i]; } 回答1: String concatenation is faster in ECMAScript. Here's a benchmark I created to show

Escape quote in web.config connection string

无人久伴 提交于 2019-11-26 10:37:38
问题 I have a connection string in my web config: <add name=\"MyConString\" connectionString=\"Server=dbsrv;User ID=myDbUser;Password=somepass\"word\" providerName=\"System.Data.SqlClient\" /> As you see, there is a quotation sign ( \" ) in the password (given from other dept. I can\'t change this db users password). How do I have to escape the quote in this connection string? Btw: I already tried & quot; in the string. That didn\'t work - ado.net got an ArgumenException then: \"Format of the

SQL Express connection string: mdf file location relative to application location

戏子无情 提交于 2019-11-26 10:30:03
I am using SQL Express databases as part of a unit test project in c#. My databases is located here: ./Databases/MyUnitTestDB.mdf I would like to use a relative path or variable in the app.config rather than having my connection string defined as: AttachDbFilename=C:\blah\blah\blah\yea\yea\yea\MyApplication\Databases\MyUnitTestDB.mdf I have seen the use of |DataDirectory| but am I correct in thinking this is only applicable to web applications? I want to control this in the application configuration file, as in production the application uses a hosted sql database. Thanks everyone, I used a

Login failed for user &#39;NT AUTHORITY\NETWORK SERVICE&#39;

流过昼夜 提交于 2019-11-26 09:34:53
问题 I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this. Please help me out. I have disable anonymous authentication, enable asp.net impersonation. I have added <identity impersonate = \"true\" /> I have added the a user to the security logins that is connected to the database I try to connect to This is the connectionstring I use: Data Source=IPTOSERVER;Initial Catalog=Phaeton;User Id=User;Password

How to check if connection string is valid?

狂风中的少年 提交于 2019-11-26 09:19:07
问题 I\'m writing an application where a user provides a connection string manually and I\'m wondering if there is any way that I could validate the connection string - I mean check if it\'s correct and if the database exists. 回答1: You could try to connect? For quick (offline) validation, perhaps use DbConnectionStringBuilder to parse it... DbConnectionStringBuilder csb = new DbConnectionStringBuilder(); csb.ConnectionString = "rubb ish"; // throws But to check whether the db exists, you'll need