Re: URGENT: ConnectionString for SQLServer db



Attaching a file does effectively cause the Sql Server instance to 'use' the
file. Remember that real Sql Server datafiles are .mdf so yes, it ends up
using it as the data file.
"Cirene" <test@xxxxxxxx> wrote in message
news:e11a3ZIOIHA.5224@xxxxxxxxxxxxxxxxxxxxxxx
Does attaching a database basically import it into an SQL Server DB, or
does it actually use the SQL Express mdf file?

"William (Bill) Vaughn" <billvaRemoveThis@xxxxxxxxx> wrote in message
news:00E45622-F611-4FE6-8481-6596E93F9D38@xxxxxxxxxxxxxxxx
A remote SQL Server database needs to be addressed in two ways:
1) The system or machine name. When the database was on the local system
this was "." but we have no way to know what that is. Let's say it's
"George".
2) The SQL Server Instance name. We have no way of knowing the instance
name on the target server would be. Let's say it's "Fred".

In this example the ConnectionString would look something like this:
"Server=George\Fred;integrated security=SSPI;initial catalog=ASPNETDB"

There is no need to reattach the database since you already attached it
to the remote server master database.

See Chapter 9 of my book.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Cirene" <test@xxxxxxxx> wrote in message
news:OlD5Ad5NIHA.4584@xxxxxxxxxxxxxxxxxxxxxxx
I developed my ASP.NET 2.0 web app using SQL Express. Now I'm moving it
to production.

On my web server I attached the SQL Express mdf database to a new SQL
Server database. The (example) SQL Server settings are:
DB Name: rnz_mydb
Server IP: sql123.MyHost.com
Login ID: rnz_admin
Db Type: MSSQL 2005

The current web.config connection string is this:
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\zASPNETDB.MDF;Integrated
Security=True;Initial Catalog=ASPNETDB"
providerName="System.Data.SqlClient" />
</connectionStrings>

What should the connection string be now (to point to the new SQL SERVER
db)?

Thanks!






.



Relevant Pages

  • Error 1813 or "WHY didnt they call me earlier?"
    ... 3- copy the data file (mdf and ndf's) over the ones from ... 4- start sql server ... >The SQL Server 7.0 database on this server appear after ... >but I get an error telling me that ldf file and mdf file ...
    (microsoft.public.sqlserver.server)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)
  • Re: MS Access DAO -> ADO.NET Migration
    ... full SQL Server and I see the logic you explained in a multi user ... allow two users to access the same database file Read/Write at any given ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... Hitchhiker's Guide to Visual Studio and SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: MS Access DAO -> ADO.NET Migration
    ... For that it is much harder to handle the incremental identifier, ... database but although they have the data, they are not connected at the same ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... SQL Server Management Studio is nowhere to be found on my ...
    (microsoft.public.dotnet.framework.adonet)