connection-string

Make the connectionstring's AttachDbFilename relative in config file

谁说我不能喝 提交于 2019-12-10 10:48:12
问题 I am working on a project using an mdf file generated locally using Entity Framework Code First. The path to this mdf is set in several config files in my solution using <connectionStrings> sections like so : <add name="DataContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename="E:\path\to\project\app_data\local.mdf";Integrated Security=True" providerName="System.Data.SqlClient" /> I use git versionning on this project both from work and at home, thus at work the mdf filepath

Transferring saved data connections between Visual Studio installations

廉价感情. 提交于 2019-12-10 10:18:14
问题 I use the data and schema comparison tools in Visual Studio a great deal. I just finished installing VS 2010 on a new VM and realized, of course, that all the saved data connections from my previous installation are not available. Is there a way to transfer these connections between installations of VS 2010? 回答1: I believe you just copy the file from C:\Users\<username>\AppData\Roaming\ Microsoft\VisualStudio\10.0\ServerExplorer\DefaultView.SEView from the installation with the data

How to create connection string dynamically in C# [closed]

為{幸葍}努か 提交于 2019-12-10 10:08:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . How to create connection string dynamically in C#, instead of creating it using string concatenation? 回答1: You can create dynamic connection string with SqlConnectionStringBuilder Class in C# as follows. for more

How To Change The Connection String saved in My.Settings in VB 2010

ぐ巨炮叔叔 提交于 2019-12-10 10:07:33
问题 I am writting an application and I used Wizard to create DataSets which auto-created their own xml code. This code uses the saved in My.Settings Connection String. Being a setting with an unchangable 'Application' scope i cannot change its value at runtime. The problem is that when I install the Application to my customer the Connection String will have to change (maybe more than once). So is there a way to change the Connection String used by these objects at runtime ? 回答1: Here's how to

Is there a need to secure connection string in web.config?

一曲冷凌霜 提交于 2019-12-10 00:58:38
问题 So I am using connection strings in my web.config using SQL authentication. Of course people say this could be a vulnerability as you are storing password in plaintext. However, from what I know, IIS never serves web.config, and web.config should only have read access to administrators and IIS anyway. So if the hacker has gained access to the webserver, then it won't matter what encryption I use because the private key will be on the webserver. Wouldn't encrypting connection string be

NHibernate config connection string info

爷,独闯天下 提交于 2019-12-10 00:19:52
问题 What's the best way to store connection string info? I'd rather not just store the db password in NHib.config file. 回答1: Use encryption on the password and/or connection string and store the encrypted password/connection string in a config file of some sort. Then use my answer here to add the connection string value to the NHibernate Configuration object after decrypting it: How to load application settings to NHibernate.Cfg.Configuration object? Like: nHibernateConfiguration.SetProperty(

Query data from SQL to MS Access: Local Tables vs Pass-Through Tables

落花浮王杯 提交于 2019-12-09 23:41:28
问题 I've created an application that uses the following logic to query data from SQL to my MS Access App. Using an ODBC connection I execute a stored procedure Using This is assigned as a Pass-Through Query to pull the data locally. It looks something like this: strSQL = "EXEC StoredProcedure " & Variable & " Call ChangeQueryDef("qryPassThrough", strSQL) Call SQLPassThrough(strQDFName:="qryPassThrough", _ strSQL:=strSQL, strConnect:=gODBCConn) Me.frmDataSheet.Form.RecordSource = "qryPassThrough"

How do I create a Solution Wide Connection String

房东的猫 提交于 2019-12-09 12:33:45
问题 Does anyone know if it is possible to create a single connection string that will be accessible to all the projects in a solution (we have about 6). I can create a text file with this information, but we need design time support as well, and it is not practical to have a connection string in every App.Config and Web.config file in the solution. We basically want a Single connection string that is easy to change should the location of the db change, that will also be used by the IDE for design

|DataDirectory| returns wrong path to AppData folder

馋奶兔 提交于 2019-12-08 20:41:38
问题 |DataDirectory|, you had one job. |DataDirectory| on IIS7.5 resolves to: C:\inetpub\wwwroot\appname\App_Data That folder does not exist. The correct folder is: C:\inetpub\wwwroot\appname\bin\App_Data All is well on the dev machine, but when I deploy to the server, AppData is placed within bin\ . I use AppData as shown in any Visual Studio 2010 project and deploy with " Build Deployment Package " (VS2010) then " Import Application " (IIS Manager). I know I can set the path manually with

How to use dynamic connection string for SQL Server CE?

自古美人都是妖i 提交于 2019-12-08 20:18:29
问题 I used SQL Server CE 4.0 in my windows app and use Entity Framework to create a model of it. It works fine but my problems is that it doesn't have a constructor to change the connection string, and by default it reads the connection string from the app.config file. using (var Context = new MyEntitiesModel(//has no constructor)) { ... } I create a dynamic connection string and using (var Context = new MyEntitiesModel()) { Context.Database.Connection.ConnectionString = entityConnection