Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Attaching a mdf
Message
De
11/11/2009 07:59:02
 
 
À
10/11/2009 12:01:24
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Divers
Thread ID:
01433962
Message ID:
01434213
Vues:
36
>>>>>>I'm looking at a demo mentioned by TC
>>>>>>
>>>>>>http://www.codeproject.com/KB/linq/linqtutorial.aspx
>>>>>>
>>>>>>this attaches a bookcatalog mdf to my SQL2008 when it starts up.
>>>>>>
>>>>>>But in SQL server management studio I don't see this database.
>>>>>>
>>>>>>I'm curious to know what the nature of this attachment is and why doesn't it stay attached.
>>>>>>
>>>>>>Thanks
>>>>>
>>>>>Did you refresh the Data engine's display? If it is attached from call external to the MS you might not see it without right-clicking on the server and picking Refresh. From that point on it should stay attached.
>>>>
>>>>Hi Charles.
>>>>
>>>>No I can't see it. I have refreshed.
>>>>
>>>>I don't know if you know the sample code. I've changed the bookcatalog.cs to point at my server. I think this is working as the the code runs ok and if I leave the server name as it was the code fails.
>>>>
>>>>Nick
>>>
>>>I just downloaded the app and haven't tested it yet, but I thought you said that after attaching you couldn't see the database attached to your server in management studio. That does surprise me if you are not looking at the wrong server ?? i.e. it attached to localhost and you are looking at MYBOX\SQLEXPRESS ??
>>>
>>>It wouldn't surprise me at all that in the app itself you needed to change the connection info to point to the instance of the database attached to your server. The database name is the same but the connection information would be completely different, no?
>>
>>Thanks Charles
>>
>>Well I've looked at localhost\sqlexpress2008 as well and its not attached to that. That seems to be the same as mybox\sqlexpress2008
>>
>>I have
>>
>>public BookCatalog( ) : base( "Data Source=.\\SQLEXPRESS2008;AttachDbFilename=|DataDirectory|\\BookCatalog.mdf;" +
>> "Integrated Security=True;User Instance=True" ) { }
>>
>>so what is it attached to ?
>
>If you have SQL Server developer or some full version it will be localhost or \\mybox.
>
>Is it there?
>
>If you can reach it from the app it is attached to something, but if your connection string just says localhost, that is not sqlexpress.

If I stop the server through the management console the example fails with

System.Data.SqlClient.SqlException was unhandled
Message="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)"
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060

if I restart the server it runs ok so I know I'm looking at the correct one.
I'm still curious what the nature of the attachment is and that it doesn't stay attached.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform