2017-05-13 19 views
0

VS 2010およびSQL Server 2008データベースを使用して.NETアプリケーションを作成しました。私は、このリンクの指示に従ってアプリを展開: http://techbrij.com/install-sql-server-database-with-visual-studio-setupデータベースを開けません。 .NETアプリケーションをインストールしているときにSQL Serverデータベースを作成するときにユーザーエラーでログインに失敗しました

しかし、私はアプリをインストールするたびに、私は例外を取得:

login.theのログインで要求されたオープンなデータベース「PharmacyDbは」失敗することはできません。ログインには、ユーザーのBahaa-PC \ Bahaa」に失敗しました

を私が管理者としてインストールを実行すると、Windowsのファイアウォールを介してSQL Serverを許可するが、私はまだ、この例外を取得してみてください

注:。。私は3 SQLスクリプトを持っています私のデータベースを作成するファイル、と私はVSまたはSQL Server Management Studioでそれらを実行するとき、彼らは完全にデータベースを作成

私が見逃している何

注2:?これはinstall.csクラス内の接続文字列であります:

string connStr = "Data Source=" + serverName + ";Initial Catalog=" + dbName + ";Integrated Security=True"; 

更新: ログファイル:私は、問題は、私はインストーラクラスのデータベースへの接続を必要とするオブジェクトを使用していることがわかった多くの試みの後

2017-05-13 13:13:17.60 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 13:13:17.60 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 13:23:10.03 spid52  Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required. 
 
2017-05-13 13:23:10.10 spid52  Using 'xpstar.dll' version '2009.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required. 
 
2017-05-13 13:24:34.49 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 13:24:34.49 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 13:35:12.71 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 13:35:12.71 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 13:36:55.95 spid53  Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required. 
 
2017-05-13 13:36:55.99 spid53  Using 'xplog70.dll' version '2009.100.1600' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required. 
 
2017-05-13 14:03:27.26 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 14:03:27.26 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 14:07:27.27 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 14:07:27.27 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 14:07:56.66 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 14:07:56.66 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-13 14:11:45.57 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-13 14:11:45.57 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>] 
 
2017-05-14 00:37:36.40 Server  Server resumed execution after being idle 35916 seconds: user activity awakened the server. This is an informational message only. No user action is required. 
 
2017-05-14 00:37:41.48 Logon  Error: 18456, Severity: 14, State: 38. 
 
2017-05-14 00:37:41.48 Logon  Login failed for user 'Bahaa-PC\Bahaa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]

+0

SQL Serverエラーログを確認します。ログインに失敗した特定の理由を示すメッセージが表示されます。 –

+0

sqlサーバーは同じボックスにありますか? Windows認証を使用しようとしているので、Bahaa-PC \ BahaaがSQLサーバーにアクセスできるようにしてください。 DBが異なる場合は、SQL認証を使用して接続文字列を変更してください。 – NMK

+0

@Dan:ログに珍しい情報はありません –

答えて

0

、私はそれを削除しました。

関連する問題