.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

.Net SqlClient Data Provider connecting as sa

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
I recently changed the sa password on a SQL 2005 std sp3 default instance. I now see .Net SQL data provider connecting with sa login from an app server. From a trace I see: Application name: .Net Sql Client data provider NTUserName: sqluser LoginName: sa HostName: app server name LoginSID: SID for sa SessionLoginName: ssd\sqluser Sqluser is a sql server logon that is not sa. SSD\sqluser is local admin on app server and is not sa on SQL SERVER and is not in builtin/administrators either. I thought an existing session may explain it but both the app server and sql server have been restarted since the sa p/w change. Could I be misinterpreting the Profiler output? Any ideas?

View Complete Post

More Related Resource Links

Login failed for user 'sa'. (.Net SqlClient Data Provider)

Hi,     I am able to login using windows Authentication to my DB server. But when I am trying using Sql server authentication "sa" then following error is coming:   =================================== Cannot connect to .. =================================== Login failed for user 'sa'. (.Net SqlClient Data Provider) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476 ------------------------------ Server Name: . Error Number: 18456 Severity: 14 State: 1 Line Number: 65536 ------------------------------ Program Location:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) &

Cannot generate SSPI context. (.Net SqlClient Data Provider)


I have upgraded SQL SERVER 2000 standard edition server to SQL server 2008 with SP1 standard edition. No errors noticed. OS is Windows server 2003 with sp2, Service accounts are configured using domain user account, and mixed mode authentication is enabled.

Both windows and SQL authentications are working fine from the local (server), able to access all SQL server resources.

Server is accessible remotely using SQL authentication, but unable to connect with windows authentication, though user has local admin and SQL admin rights on the server.

Let me know any solutions for this. Appreciate your support

Login failed for user (.Net SqlClient Data Provider)


I have a dedicated server, which runs windows server 2003 web edition. I access the server using remote desktop. I have installed sqlserver express 2005 on the server, along with management studio express. I have problem running the sql script that would install the database. It says that remote connection is disabled by default on sql express 2005. So this is what I did ( as suggested by this article: http://www.datamasker.com/SSE2005_NetworkCfg.htm):
Enable the TCP/IP protocol using the Surface Area Configuration Utility 
Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility 
Make sure the SQL Server browser is started.
Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine. sqlservr.exe and sqlbrowser.exe as an exception in the windows firewall

Still no success. Reading various articles on internet, a few suggested i should grant access to certain user by running the following command

The problem is that i keep getting the error login failed, even when i try to connect to the sqlserver using management studio. When I use remote desktop it logins as administrator.
Can someone please

Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

ADO.NET: Building a Custom Data Provider for Use with the .NET Data Access Framework


The System.Data.dll assembly in the .NET Framework contains namespaces whose base classes can be used to create custom data providers. These namespaces also define a number of data access interfaces and base classes that let developers create data providers that will interoperate with other custom providers. Using the ADO.NET classes Connection, Command, DataReader, and DataAdapter, writing a provider is easier than writing one for OLE DB. This article explains these classes and their implementation, and how they can be used to write a variety of different kinds of data providers.

Bob Beauchemin

MSDN Magazine December 2001

Trying to run a stored procedure from vb code with oracle data provider.



Here is my SP:

create or replace
 Open p_getuserssignon_recordset1 for
 SELECT Distinct(Userid), UserPassword, SecurityLevel, ActiveStatus
WHERE substr(UserId,1,2) <> vUid
Order By UserId;

I would like to run this SP from code and fill a gridview with the result. 

I am not sure how to go about this, as I have found several different examples, other than the one I  think I need.

I am using the oracle data provider and I have an input parameter (vUid, which will equal "zz").

First question. When filling a gridview with a result set from a stored procedure should the recordset OUT be defined as a REFCURSOR (like i did above)? 


Do you have example code as to how to execute the SP and fill a gridview?  I keep trying different variations of code i've found on the internet without any success other than getting more confused.

(I am using VS 2005, VB).

Thank you.



Video: Connecting PivotTables in Excel 2007 to Data Stored in SharePoint Lists

Learn how to use the Open XML SDK 2.0 to create Excel 2007 PivotTables that are connected to data stored in SharePoint lists.

System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlCli

I have created a windows library control that accesses a local sql database I tried the following strings for connecting Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true" Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"   I am not running the webpage in a virtual directory but in C:\Inetpub\wwwroot\usercontrol and I have a simple index.html that tries to read from an sql db but throws the error System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)   at System.Security.PermissionSet.Demand()   at System.Data.Common.DbConnectionOptions.DemandPermission()   at System.Data.SqlClient.SqlConnection.PermissionDemand()   at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, etc etc  The action that failed was:DemandThe type of the first permission that failed was:System.Data.SqlClient.SqlClientPermissionThe Zone of the assembly that fa

System.Data.SqlClient.SqlException: Bulk load data was expected but not sent

Hi everyone We've had this error twice now from our C# code. Nothing is changing the columns, but I've noticed though that it appears to happen when two threads are attempting to bulk insert into the same table, generally millions of rows. The docs say that SqlBulkCopy.WriteToServer is not guaranteed to be thread-safe, but is this the problem here? It feels like it. I've seen some posts where people appeared to have experienced problems in similar circumstances (http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/85d51484-6381-46bc-bcce-63b58b362d2d). There is no identity column just a non-unique clustered index that is (spid) process keyed to each thread. Do I need to synchronise access to the table for WriteToServer - is this a known problem? Many thanks Reg --- System.Data.SqlClient. SqlException: Insert bulk failed due to a schema change of the target table.   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)   at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal()   at System.Data.SqlClient.SqlBulkCo

System.Data.SqlClient.SqlError: There is insufficient free space on disk volume 'C:\' to create th

I received the following error...*****System.Data.SqlClient.SqlError: There is insufficient free space on disk volume 'C:\' to create the database. The database requires 2739929088 additional free bytes, while only 801185792 bytes are available. (Microsoft.SqlServer.Smo)*****I have looked at the solution recommended on this forum http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79848 but I am still baffled as to why it says that I don't have enough disk space?  I ran the RESTORE FILELISTONLY command and it told me that the "size" was 1.4 GB and I've got 60GB left. I am starting to resolve that my .BAK is corrupt.  Are there any other reasons as to why I am unable to restore my backup?Thanks for any help in advance!

RSACrytoService Provider decrypt each element with seperate key gives Bad Data

I have spent about two days. Here is my code: XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.Load("C:\\test.xml"); CspParameters cspParams = new CspParameters(); cspParams.KeyContainerName = "XML_ENC_RSA_KEY"; RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider(cspParams); CspParameters cspParams2 = new CspParameters(); cspParams2.KeyContainerName = "XML_ENC_RSA_KEY2"; RSACryptoServiceProvider rsaKey2 = new RSACryptoServiceProvider(cspParams2); Encrypt(xmlDoc, "creditcard", "EncryptedElement1", rsaKey, "rsaKey"); Encrypt(xmlDoc, "personal", "EncryptedElement2", rsaKey2, "rsaKey"); This works gerat. Now I want to decrypt the 'creditcard' and 'personal' data elements seperately with 'rsakey' and 'rsakey2' . If do this I get Bad Data error public static void Decrypt(XmlDocument Doc, RSA Alg, string KeyName) { EncryptedXml exml = new EncryptedXml(Doc); exml.AddKeyNameMapping(KeyName, Alg); exml.DecryptDocument(); } This gives bad data since the file has been encrypted with two different keys. So I tried something like this. But I don't know how to decrypt each data element seperately.  Can someone please help? public static void DecryptElement(string ElementToEncrypt, RSA Alg, string KeyName) {

mysql data source provider - mysql connector/net

Dear All, I having problem installing mysql connector/net 6.2.3 on my vsd 2010 because the installed went smoothly but when Im trying to use the mysql on data source provider, I cant see it on the list and when try to install/change the connector the visual studio integreation has an x mark meaning to say it was not installed on my vsd2010.  Thanks.

Connecting a Sharepoint Custom list with an external Data-source

Hi I am planning to connect a Sharepoint Custom list with an external Data-source. External DB will be in Access 2007 format. More Information: I need a solution that we can connect our sharepoint list (one-way) to online db in a way that new  information is directly updated in the sharepoint list, whilst other info changed in sharepoint list  is not synced back to original value. Is there a way to solve this? -saumil

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

 Hi all,When i run my project on my own computer, it works fine. But when i deploy it to server, it gives me this error. I can run my other dts and sp, but i get this error on this.. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. I googled it but could not find a solution. How can i solve this problem? 

System.Data.SqlClient.SqlException was unhandled by user code

System.Data.SqlClient.SqlException was unhandled by user code  Message=Incorrect syntax near '01'.Unclosed quotation mark after the character string ' from month_day where month_name=datename(month,dateadd(month,01,0)-1)'.  Source=.Net SqlClient Data Provider  ErrorCode=-2146232060   LineNumber=1  Number=102  Procedure=""  Server=W2003-VM1-MK  State=1  StackTrace:       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()       at System.Data.SqlClient.SqlDataReader.get_MetaData()       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)   &nbs

CS1061: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Item' and no ex

I'm making the switch from vb.net to C#, and am just trying to do a simple sql query and bind some of the data returned to a label.  BUT, I'm getting this error.. CS1061: 'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Data.SqlClient.SqlDataReader' could be found (are you missing a using directive or an assembly reference?) Here's my code behind:    What am I doing wrong??? using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data; using System.Configuration; public partial class Section : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { getSectionContent(); } protected void getSectionContent() { SqlConnection conn = default(SqlConnection); SqlCommand comm = default(SqlCommand); SqlDataReader reader = default(SqlDataReader); string connectionString = ConfigurationManager.ConnectionStrings["123"].ConnectionString; conn = new SqlConnection(connectionString); comm = new SqlCommand(); comm.Connection = conn; comm.CommandType = System.Data.CommandType.StoredPr
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend