PDA

View Full Version : خطای A network-related or instance-specific error occurred



mostafaapple
چهارشنبه 10 اسفند 1390, 17:43 عصر
وقتی می خواهیم یک برنامه که در آن اجرا کنم با این خطا روبرو می شوم
sql server 2008 r2 را هم نصب کردم ولی باز هم مشکل دارم
اگر راه حلی هست لطفا بگید چون چند روز که باهش درگیرم
با تشکر


error:
unhandled exception has occurred in your application. if you click continue, the application will ignore
this error and attempt continue. If you click quit, the application will close immediately


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


قسمت مربوط به details


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.SqlClient.SqlException: 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)
at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.Att emptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.Log inNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Library.DataAccess.connect() in D:\Upload\sors cood\ketabkhane\LibrarySourceCsharp\Library\DataAc cess.cs:line 32
at Library.frmLogin.btnLogin_Click(Object sender, EventArgs e) in D:\Upload\sors cood\ketabkhane\LibrarySourceCsharp\Library\frmLog in.cs:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)

Mahmoud Zaad
چهارشنبه 10 اسفند 1390, 18:58 عصر
سلام
مشکل از کانکشن استرینگه. دیتابیس رو اتچ کنید، ببیند مشکل حل میشه

shadi khanum
چهارشنبه 10 اسفند 1390, 19:31 عصر
دوست عزیز connectionStringتون رو چی گذاشتید؟

mostafaapple
چهارشنبه 10 اسفند 1390, 21:01 عصر
سلام
دیتابیس را اتچ کردم مشکل حل نشد
دیگه نمی دونم باید چکار کنم
کانکشن استرینگ چطوری باید تنظیم کنم؟

Mahmoud Zaad
چهارشنبه 10 اسفند 1390, 21:27 عصر
توی قسمت server explorer کانکشن رو add کنید توی همون پنجره add connection ابتدا دکمه Test Connection رو بزنید تا پیغام درست بودن کانکشن رو بگیرید بعد دکمه advanced... رو بزنید پایین پنجره باز شده کانکشن استرینگ وجود داره می تونید از اون استفاده کنید.

mostafaapple
پنج شنبه 11 اسفند 1390, 02:01 صبح
خیلی متشکر ، درست شد