0

Visual Studio 2012 で Visual Studio 2010 ソリューションを開くと、次のメッセージが表示されます。

SQL Server Express と LocalDB

Web.config ファイルで、接続文字列を変更しました

から:

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

に:

connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename
=|DataDirectory|\databaseName.mdf;Integrated Security=True"

データベースに接続できず、アプリケーションを実行してもエラー メッセージが表示されます。

An attempt to attach an auto-named database for file (FILE) failed. 
A database with the same name exists, or specified file cannot be opened, 
or it is located on UNC share.

The attempt to attach to the database failed with the following information: 
Failed to generate a user instance of SQL Server due to a failure in starting 
the process for the user instance. The connection will be closed.
4

2 に答える 2

0

データベースに接続できましたが、まだエラー メッセージが表示されます。

  • サーバー エクスプローラー (ビュー > サーバー エクスプローラー) で、[データベースに接続] ボタンをクリックします。
  • データ ソース: Microsoft SQL Server (SqlClient)
  • サーバー名: (LocalDB)\v11.0
  • データベース ファイルを添付: mdf ファイルへのパス
  • テスト接続
  • OK (テスト接続が成功した場合)

これらのすべての手順の後、サーバー エクスプローラーのデータベース アイコンに緑色のアイコンが表示されます。

データベースを右クリックしてプロパティを選択し、接続文字列を選択して Webconfig ファイルに貼り付けます。

Default.aspx ファイルで F5 キーを押しても、次のエラー メッセージが表示されます。

Sql exception was unhandled by user code

An attempt to attach an auto-named database for file C:\(path to file) failed. 
A database with the same name exists, or specified file cannot be opened, 
or it is located on UNC share.

ファイル CategoriesBLL.cs の次の行にエラー メッセージが表示されます。

return Adapter.GetCategories();
于 2013-07-28T21:57:49.880 に答える
0

プロジェクトのソリューションをダブルクリックするだけです。そして、プロジェクトを自動的に変換します。

于 2013-07-26T09:53:45.027 に答える