PDA

View Full Version : مشکل با یوزر sa در #c



davodsharif
یک شنبه 16 اردیبهشت 1386, 23:51 عصر
با سلام
یک دیتابیس با سی شارب و sql 2000 ساختم که در اون از یوزر sa استفاده شده بود . برنامه به درستی کار می کرد . اما بعد از پاک کردن و نصب دوباره sql و #c برنامه به یوزر sa ایراد می گیره و نمی تونه اون رو پیدا کنه.
لطفا کمکم کنید.


public const string _Connection =
"server=localhost;database=data;" +
"user id=sa;password=;";

moradidn
دوشنبه 17 اردیبهشت 1386, 02:59 صبح
در Enterprise Manager از LocalHost با کلیک راست Property گرفته و Authentication Mode را در حالت
Windows and SQLServer قرار دهید.بعد از restart نمودن SQLServer احتمالا مشکل حل خواهد شد. البته اگر پیغام خطا را ذکر میکردید مشکل سریعتر تشخیص داده میشد.

davodsharif
سه شنبه 18 اردیبهشت 1386, 11:05 صبح
پیغام خطایی که می گیرد :


{"Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection."}

davodsharif
سه شنبه 18 اردیبهشت 1386, 11:06 صبح
اطلاعات کامل تر



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: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
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.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.Com pleteLogin(Boolean enlistOK)
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 System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at WindowsApplication5.Frm1.FillDataAndView() in F:\My Documents\Visual Studio 2005\Projects\WindowsApplication5\WindowsApplicati on5\Form1.cs:line 36
at WindowsApplication5.Frm1.Form1_Load(Object sender, EventArgs e) in F:\My Documents\Visual Studio 2005\Projects\WindowsApplication5\WindowsApplicati on5\Form1.cs:line 69
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WindowsApplication5
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/sharif/Aria/WindowsApplication5.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
AMS.TextBox
Assembly Version: 2.0.2047.21388
Win32 Version: 2.0.2047.21388
CodeBase: file:///C:/Program%20Files/sharif/Aria/AMS.TextBox.DLL
----------------------------------------
Controls
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/sharif/Aria/Controls.DLL
----------------------------------------
AnalogClockControl
Assembly Version: 1.0.1870.27293
Win32 Version: 1.0.1870.27293
CodeBase: file:///C:/Program%20Files/sharif/Aria/AnalogClockControl.DLL
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

moradidn
چهارشنبه 19 اردیبهشت 1386, 12:35 عصر
باید عرض کنم با توجه به پیام خطایی که نوشتید بنظر بنده باید مشکل با تنظیم Authentication mode رفع میشد.
لطفا مطمئن شوید که authentication mode در حالت windows and sql بوده و Password در ConnectionString صحیح وارد شده باشد.




Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
View products that this article applies to.
Author: Yuval Sinay MVP
Community Solutions Content Disclaimer
Article ID : 555332
Last Review : June 25, 2005
Revision : 1.0
SUMMARY
The following knowledgebase article will help you to resolve error message "Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)" during SQL logon process.


SYMPTOMS
During a logon process to SQL server the following error may appear: "Login failed for user 'username'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)".


CAUSE
The SQL server has been configured to operate in "Windows Authentication Mode (Windows Authentication)" and doesn't allow
the use of SQL accounts.


RESOLUTION
Change the Authentication Mode of the SQL server from "Windows Authentication Mode (Windows Authentication)"
to "Mixed Mode (Windows Authentication and SQL Server Authentication)".


MORE INFORMATION

Authentication Modes

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_47u6.asp

INF: How to Connect to an SQL Server 2000 Named Instance with the Previous Version's Client Tools

http://support.microsoft.com/default.aspx?scid=kb;en-us;265808

davodsharif
پنج شنبه 20 اردیبهشت 1386, 00:32 صبح
با تشکر از شما دوست عزیز مشکلم حل شد

با ارزوی موفقیت