connection-string

web.config transform - delete comments from connectionstring section

▼魔方 西西 提交于 2019-12-04 15:36:05
问题 I store several different connection strings in my web.config for development and testing. All but one is commented out so I can change info as needed. When I publish, I would like to replace everything (including comments) in the connectionStrings node with this: <add name="myDb" connectionString="Data Source={SERVER};Initial Catalog=ManEx;User Id={USER};Password={PASSWORD};" providerName="System.Data.SqlClient" /> <!--<add name="myDb" connectionString="Data Source={SERVER};Initial Catalog

Connecting to SQL server from another computer

て烟熏妆下的殇ゞ 提交于 2019-12-04 15:10:20
I am using c# to connect to sql server on another computer on the network but i got an exception message Login failed for user ' username' however the server log state that the connection is successful for the user using windows authentication my connection string is: "Data Source=ipaddress,1433;Initial Catalog=database;Trusted_Connection=True;Integrated Security=False;Connect Timeout=30;user ID=username;password=password" I am using microsoft sql server 2008 R2 Thanks in advance There are few things you should check: Remove "Trusted_Connection=True;" in your connection string Turn off the

SQL providerName in web.config

≯℡__Kan透↙ 提交于 2019-12-04 14:56:05
问题 We are using ASP.NET (Framework 2) and setting database connection strings (SQL2005) in web.config. We are currently using " providerName=SqlServer ". All our data accesses are done using System.Data.SqlClient - should we therefore change to providerName=System.Data.SqlClient ? I find many examples of this providerName on the web, but very little explaining what providerName=SqlServer actually means. Is there a difference? I'm worried that the providerName we currently specify is actually

How to deploy an SQL Compact Edition database file (.sdf) in the AppData folder? Connection string?

陌路散爱 提交于 2019-12-04 14:56:01
I'm planning to deploy my DB file in the Users\CurrentUserName\AppData folder, because default User Account Control settings restrict write access to the Program Files directory where my program is installed. First question - is this correct? So far, I've created a custom folder, set the DefaultLocation property to [LocalAppDataFolder][ProductName] , and put the .sdf file in that folder. This works in Windows 7, but it doesn't seem to work in Windows XP - I can't find any sign of it being deployed anywhere. So where and how should I deploy the DB file? I'm also unsure how to set the connection

How to vary connection string for different work locations

≡放荡痞女 提交于 2019-12-04 13:49:18
问题 I am working on a C# 4.0, WPF 4.0, SQL 2008 project and I do work at home and in the office. I just setup SubVersion using Visual SVN per the recommendations found in other questions. The problem I am having is the connection string for the database is different for each location. At home I have the database on my dev system, in the office the database is on our server. Neither is exposed to the internet so I have to use both. Is there an elegant way to automatically select the correct one?

How to make sql membership provider and entity framework work using my database?

亡梦爱人 提交于 2019-12-04 13:16:55
I have .NET MVC 3 project where I use sql membership provider and entity framework. I've created new database on my SQL server and created all objects for membership provider using aspnet_regsql.exe , I've changed my connection string and it works fine. Now I want to use entity framework for db interaction. I'm using Code-First so I created simple entity class and I can save data to db and retreive it. The problem is that the place where entity framework keeps it's data is a mistery. I can not find any database in my project and there are no new tables in my SQL database. If I add second

How do I increase the Command Timeout in OrmLite ServiceStack?

∥☆過路亽.° 提交于 2019-12-04 11:27:32
I am using ServiceStack OrmLite SqlServer v3.9.71 and have the following connection string: <add key="ConnStr" value="Data Source=my-db;Initial Catalog=Users;Integrated Security=SSPI;Connection Timeout=666"/> and am using the following to run a query which takes 2-3 minutes to come back: using (Db) { var result = new ResultDto(); Parallel.Invoke( () => { result.StatOne = Db.Dictionary<DateTime, int>(query1); }, () => { result.StatTwo = Db.Dictionary<DateTime, int>(query2); } ); return result; } When putting a break point on the Db object, I can see the connection time out to be 666 but I can't

WPF MVVM Samples with Database

喜你入骨 提交于 2019-12-04 11:26:58
问题 What examples exist of Windows Presentation Foundation (WPF) Model View ViewModel (MVVM) that include sample database connections? 回答1: The BookLibrary (WPF MVVM) sample application of the WPF Application Framework (WAF) uses the Entity Framework in combination with a SQL CE database. 回答2: you could have a look at those: http://www.codeproject.com/KB/WPF/WPF_MVVM_DB_Access.aspx http://karlshifflett.wordpress.com/mvvm/wpf-line-of-business-introduction/ or just this: http://www.google.com

SQL Express connection string hell ASP.Net

浪子不回头ぞ 提交于 2019-12-04 10:17:39
SQL Express 2005 is running locally. I have a project written by another person running on the same machine. All I want to do is connect to it, can't be that hard right? This is the one I use in my old classic ASP code to hit another database running on the same instance: Provider=SQLOLEDB;Data Source=MYLAPTOP\MSSMLBIZ;Persist Security Info=True;User ID=TestUser;Password=letmein;Initial Catalog=TestDB But trying a version of that makes the .net code throw a wobbler as he's written it using SQLServer drivers so its not liking the Provider stuff. Here is the orginal connection string from his

What is the proper method for encrypting ASP.NET connetionStrings?

偶尔善良 提交于 2019-12-04 09:45:09
问题 I've been looking through several examples of encrypting connectionStrings (Web.config) in an ASP.NET MVC application (.NET 4.0) and it seems that there are two general ways to achieve it (example 1 and the related example 2): Use the aspnet_regiis tool. The main issue with using aspnet_regiis is that I can run the tool locally (on my development machine), but the web site actually hosted on Arvixe and like any other web host: there is no way to run commands on the server. As far as I