.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Connection string for Sql 2008 Express R2 and Publishing

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
HI everyone,I am currently working on a project and I am hosting it on my IIS to test it every so often but now i have an issue:When i run in debug mode with this connection string:Data Source=.;AttachDbFilename=c:\New folder\dbname.mdf;Database=dbname;Trusted_Connection=Yes;everything works fine and i can access the database but once its published onto my iis it doesnt find the database?Can someone please help?

View Complete Post

More Related Resource Links

Connection string to connect with Sql Server 2008.



May  be it's a wrong place to ask the following question. Sorry for that. Our hosting provider has recently upgraded their database server from Sql Server 2005 to 2008 and I'm getting errors to connect with remote server from my development machine. Error Message "Invalid connection". Tried to find solution on net but couldn't find it.

I'm using .Net 1.1. Though we've updated versions 2.0,3.5 & 4.0 but due to some certain circumstances I've no way to update it. It's a web based project. The following connection string works fine for Sql Server 2000 & 2005 but not for 2008.

<add key="ConnectionString" value="Data Source=Remote Server's domain name;Initial Catalog=database name;User ID=user name;Password=surround;Persist Security Info=True;Pooling=false;Connect Timeout=45;" />


Remote Server's domain name indicates to remote db server like: test.mysite4now.com

database name for example: test_surround

user name like test_surround

password: surround.

Can anyone inform me what's wrong with the above connection string to connect to Sql Server 2008.



web.config connection string problem within VisualStudio 2010 to point to SQL Server 2008 R2 Develop


Hello All, I would appreciate any help with this.

I believe my problem exists within the web.config which already had code in it to connect to SQL Server Express 2008.

I uninstalled the SQL Server Express that came with Visual Studio 2010.

I installed SQL Server 2010 R2 Developer, and I'm able to connect via Management Studio and through Visual Studio's Server Explorer's Data Connections I am connected.

I did run aspnet_regsql.exe within the 4.0 folder in order to create the database with Microsoft Service Providers.

Here is the ServerName: USER-5529234649 

Here is the name of the DataBase:  StepByStepChapter9

Here is the name of the Connection within Visual Studio's Server Explorer's Data Connections:  user-5529234649.StepByStepChapter9.dbo

Here is the code I changed in the web.config:

<add name="ApplicationServices" c

Cannot connect to SQL Server 2008 RS Express, only connection to SQL Server 2008 Express succeeds?


Hi all,

my experience with SQL Server tends to zero. I've recently installed the new SQL Server 2008 RS Express with Advanced Services on my VISTA-machine because this version is prerequisite for installing some sample databases. There already existed a simple version of SQL Server 2008 express installed together with an older Visual Studio Express version. I thought that one would be upgraded but in fact the setup program installed the new 2008 RS version side-by-side to the older version.

The SQL Server ConfigManager shows actually both servers as running. SQL Server 2008 express named as "SQLEXPRESS" (Vers. 10.0.2531.0; path: '...\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn\') and the newer SQL Server 2008 RS express as "MSSQLSERVER" (Ver. 10.50.1600.1; path: '...\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn\'). But MS SQL Server Management Studio only lets me connect to the older SQLEXPRESS-Server, the new "MSSQLSERVER" doesn't even show in the "Connect-to-Server"-dialog.

What went wrong? I'd appreciate any help,


sql server 2005 express and c# 2008 express connection problem



I can't get my C# app to connect to the DB.  I have tried numerous diff ways to connect.  The DB is there, I can get to it thru sql server, just not from C#.  I keep getting the following message -

Error accessing the database, a network-related or instance-specific error occurred while establishing a connection to sql server.  The sever was not found or was not accessible.  Verify that the instance name is correct and that sql server is configured to allow remote connections. Provider: sql network interfaces, error 26 - error locating server / instance specified.

All is on my home PC running XP Home Edition.


SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly.


I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

 I have two SQL Server instances installed.

 1- UserLT (this is sql 2000)
2- UserLT\SQL2005 (this is SQL 2005 named instance)

But when i try to add a database to my VS website project I get the following error:

Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

and changed the "SQLEXPRESS" to "USERLT\SQL2005".

But I still get the same error message. Any ideas how i can resolve this issue?

Modifying connection String in Web config using Install Wizard



Im trying to create a Web Deployment Project, the built in setup and deployment is very good in Visual Studio, i need to able to add an additional step in the setup to change the connection string in the Web config file. Ive seen a lot of articles on how to do this and in particular this http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx#7162670 I am however stuck on the final part of this tutorial, im using the code Scott provided but have two errors,  heres part of my code where the errors are

using System;
using System.Configuration;
using System.Configuration.Install;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.DirectoryServices;

 void ConfigureDatabase(string targetSite, string targetVDir, string connectionString)
            // Retrieve "Friendly Site Name" from IIS for TargetSite
            DirectoryEntry entry = new DirectoryEntry("IIS://LocalHost/" + targetSit

FLV file in Visual Web Developer Express 2008


I'm trying to embed a flv in my web page and I don't have a clue how to do it.

I downloded and installed ASPNetFlashVideo and the tools do not appear in my toolbox.

So if anyone has a work around it would be greatly appreciated.

CSS support in visual studio 2008 express edition


I have several css style sheets I want to work with.  I have copied them into the appropriate directory structure in my project.  The styles are applied correctly.

But the manage CSS styles tool bar on the left margin doesn't seem to work correctly.  At one point I had generated a style sheet and worked with it there, but now it not only can't find the one it generated, but the attach style sheet link doesn't respond at all, nor does anything in this bar.  Same deadness with the CSS Properties bar.  With or without a style sheet loaded in the editor -- a style sheet that is active in the project such that when I run it, the styles are applied.

VB version of studio, running on Vista home basic.

PS, the design mode works a lot better than the professional version I use in my day job on XP and server 2003.

Need help uninstalling incomplete Visual Web Developer 2008 Express Edition with SP1


I need to get a list of programs/files that were installed when I was trying to install VWD 2008 so I can go through and remove them.  The installation did not actually install the main part of the program so I can't start with removing Microsoft VWD 2008 (a folder was created in Program files but it is empty.  I found this (below) but I'm not sure that it applies. I don't want to remove programs/files that are being used by other programs. (I can't just try to install again because there is not enough room on my hard drive)

Uninstalling Previous Versions of Visual Studio 2008

This article applies to pre-Release versions of Microsoft Visual Studio 2008. For 2005 version of this document, see Uninstalling Previous Versions of Visual Studio 2005.

For best results, Visual Studio 2008 should b

How to connect to local instance of SQL Server 2008 Management Studio Express ?


I just installed SQL Server 2008 Management studio Express on my Vista machine.

i tried connecting to local machine using :

.\sqlexpress, (local)\sqlexpress, or .\SQLExpress, MyPCNAME\SQLExpress

nothing is working, getting this error:

Cannot connect to PC-NAME\SQLEXPRESS. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

guide to uninstall sql express 2008 and install sql express with managment studio

i have installed sql express 2008 and i need to install sql express 2008 with management studio what steps do i have to follow ? I have downloaded the 3 variances of sql1.sql express 2. sql express with management studio . 3.sql express with advanced servicesHow can i completely uninstall sql 2008 express and install it with management studio?Thank you for your timeAlex

Can't Create ODBC to Local SQL Server Express 2008

Hello. I have SQL Server Express 2008 SP1 LOCALLY on my Windows XP Professional SP3 box. I have databases already created in Access 2007 that I imported into SQL. Now I want to keep the front end Access forms for data entry but have them connect to the databases in SQL. What I can't seem to do is connect from Access to the SQL db's because I can't create the ODBC connection. When I try to connect, I get the following two 'Connection failed' errors: 1. SQLState: '08001' SQL Server Error: 10061 [Microsoft][SQL Server Native Client 10.0]TCP Provider: No connection could be made because the target machine actively refused it. 2. SQLState: 'HYT00' SQL Server Error: 0 [Microsoft][SQL Server Native Client 10.0]Login timeout expired Additionally, this information may help. 1. Windows firewall is turned off. 2. In SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLEXPRESS, Shared Memory, Named Pipes and TCP/IP are all 'Enabled'. The order is Shared Memory (1), Named Pipes (2) and TCP/IP (3). 3. In SQL Server Configuration Manager > SQL Native Client 10.0 Configuration > Client Protocols, the above three are also 'Enabled'. The order is Shared Memory (1), Named Pipes (2) and TCP/IP (3). Double-clicking TCP/IP tells me that the default port is 1433. 4. Running "netstat -ano", I see no entries for [myIPaddress]:1433.

Deploying problem with SQL Express 2008 R2

Scientific software package works fine with SQL Express 2008 R2 on developing (mother) PC and Admin login mode, but difficulties are found elsewhere during installing and deploying on the client PCs.  We have used from year 2000 BDE (Borland Database Engine), which worked fine until now, but recently customers had been installing problems with Vista, Windows 7 and the local administration rights or permissions.   Thus I thought to test NT AUTHORITY\NETWORK SERVICE authentication, as this system is hopefully working again decades with coming new Windows versions. As not need to touch databases, ADO and authentication matters during last decade, I’m newbie with those topics.  Worked now few days with this problem, installed and unistalled SQL servers according to instructions, tested different connecting strings and now cannot found correction.  Solution is maybe and hopefully simple.   Attached is log data cut from (old and many times corrected) the main mother XP platform in Admin and Client (Guest) modes.  Same tests are done also with fresh XP installation on VirtualBox.  Used connecting strings are presented inside log files:           Main mother XP at Admin login:   2010-08-20 08:24:45.82 Server      Server local connection provider is ready to accept connection on [ \\.\pip

Custom security via connection string

Hi Is it possible to pass information into the SQL Server relational engine via the connection string in the same way as it can be done for Analysis Services? I need to generate a user context for a forms authentication application (i.e. no windows user accounts). SSAS allows you to pass in a list of database roles or a customdata parameter on the connection string. These can be used inside the database in lieu of a windows identity. I am wondering if there are equivalent parameters available for the SQL connection string.  I guess that I could create SQL logins from each of the forms users with a system generated password and then pass the uid and password on the connection string but this seems unnecessarily complicated. Andrew Wiles - www.it-workplace.com - MDX made simple
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend