Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T. SQL Server
ASP.NET SQL Server error: The connection was not closed. The connection's current state is open
The following error occured when 2 requests hit an ASP.NET (2.0) web app (using SQL Server 2005) at the same time: The connection was not closed. The connection's current state is open Normally this only occurs if you have a connection that is not being closed. However in our case all connections where being closed using a try-finally block (personally I prefer using a using block). This error only occured when the 2 request were initiated from different machines. It turns out that the error occured ......

Posted On Tuesday, September 9, 2008 12:48 PM

SQL Server 2005 error: VIA Provider: The specified module could not be found.
When trying to use sqlcmd.exe - and not specifying the server and instance name I got the following error: C:\Program Files\Microsoft SQL Server\90\Tools\Binn>sqlcmd -E -d masterHResult 0x7E, Level 16, State 1VIA Provider: The specified module could not be found. Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does ......

Posted On Wednesday, March 12, 2008 6:00 PM

SQL Server - dropped table that was users default table - causes: Cannot Open User Default Database, Login Failed Microsoft SQL Server, Error 4064
This error (Cannot Open User Default Database, Login Failed Microsoft SQL Server, Error 4064), occurs when you try to connect to a SQL Server 2005 server where the default database for your user has been dropped. Unfortuntely this occurs in Microsoft SQL Server Studio too - which means you cannot use it to resolve the issue (ie change the default database assigned to your login). However you can resolve this using ye-olde command prompt... 1) At the command prompt enter: sqlcmd -E -d master This ......

Posted On Monday, February 11, 2008 1:59 AM

System.ObjectDisposedException: Cannot access a disposed object. Getting Linq to prepopulate/explicitly fetch data from the database.
Exception: System.ObjectDisposedExcept... Cannot access a disposed object. Object name: 'DataContext accessed after Dispose.'. This can occur when using Linq to SQL to retrieve data from a database - and when you try to access data after the data context object has been disposed. More specifically, the exception occurs when trying to access an item that has not yet been retrieved from the database and the data context object has been disposed. This often occurs when using a variable, that was populated ......

Posted On Tuesday, June 3, 2008 9:41 AM

Cannot change column to Not Null: Cannot insert the value NULL into column '', table '.dbo.Tmp_'; column does not allow nulls.
When modifying a table SQL Server (2005) and unchecking a column's 'Allow Nulls' (ie trying to make the column Not Null) the following error may occur: '<tablename>' table- Unable to modify table. Cannot insert the value NULL into column '<columnname>', table '<dbname>.dbo.Tmp_<... column does not allow nulls. INSERT fails.The statement has been terminated. This occurs if there is already data in this table and this column contains nulls. The solution is to simply ......

Posted On Thursday, May 29, 2008 9:05 PM

SQL Server datetime set blank or null = SQL Server error: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
This error (System.Data.SqlTypes.SqlTy... SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.) will occur if you try to pass an uninitialised DateTime value into an SQL Server stored procedure from .NET code (in my case C# in an ASP.NET app). To work around this you must pass in a value - null will not work. In my case I have a generated class that passes a System.DateTime variable into the System.Data.SqlClient.SqlCo... method. So my ......

Posted On Wednesday, November 8, 2006 8:32 PM

Cannot add diagram to SQL Server 2005 DB: Database diagram support objects cannot be installed because this database does not have a valid owner.
When trying to add a diagram to an SQL Server 2005 db I got the following error:Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects. I tried the suggestion mentioned in the message but that didnt work. Also found that SQL Server Management Studio ......

Posted On Wednesday, July 5, 2006 7:36 PM

SQL Server 2005 SQLExpress error: ...provider: Named Pipes Provider, error 40 - Could not open connection to SQL Server
I got this error immediately after installing VS2005 & SQL Server 2005 Express and trying to establish my first connection using the new server - not a good start at all - and by the looks of it, it's happened to many hundreds, if not thousands, of others too. Generally this error occurs if you cannot connect to the SQL server - as the message says (no sh*t). However, what's not obvious is why... First suggestion is to make sure that you specifiy the instance name as well as the server name (christ ......

Posted On Monday, January 30, 2006 12:32 PM

Converting SQL Server data types to .NET types

The following link contains a list of Microsoft SQL Server data types and a list of their .NET CLR equivalents: http://msdn2.microsoft.com/en-us/library/ms131092.aspx

And this link shows the mapping between C# built-in types and the .NET CLR types: http://msdn2.microsoft.com/en-us/library/ya5y69ds.aspx

 

Posted On Saturday, December 10, 2005 12:32 PM

Great multi-vendor DB Tool == Aqua Data Studio
Came across a great multi-vendor db tool today called Aqua from AquaFold. It's much like the Enterprise Manager that comes with MS SQL Server - but, personally I think it's waaaay better - more functionality (intelli-sense would be one of my favourites) etc. It supports most of the main rdbms's: Oracle- 8i/9i/10g DB2 UDB- 7.x/8.x MS SQL Server- 2000/2005/7/MSDE Sybase ASE- 11.x/12.x/15 Sybase Anywhere- 6/7/8/9 Informix (IDS)- 7.x/9.4/10 Postgresql- 7.x/8.0 MySQL- 3.x/4.x/5 Generic JDBC[tm] Generic ......

Posted On Friday, November 25, 2005 11:42 AM

Syntax error converting from a character string to uniqueidentifier.
I got this error (Syntax error converting from a character string to uniqueidentifier.) when trying to run the following SQL insert from within Query Analyser: insert into [dbo].[TeamUsers] ([TeamId], [UserId], [RoleType]) values (3, 'f7b681c0faeb11d69aed0008c7... Column UserID is a uniqueidentifier. So I tried it without the quotes: insert into [dbo].[TeamUsers] ([TeamId], [UserId], [RoleType]) values (3, f7b681c0faeb11d69aed0008c7e... .. but got this error: The name 'f7b681c0faeb11d69aed0008c7... ......

Posted On Tuesday, October 4, 2005 2:40 PM

Resetting DNN or asp.net membership password and password salt
If you're a plonker like me and have forgotten a password, you have 2 options: Call the 'aspnet_Membership_ResetPas... sproc. Simply update the aspnet_membership table manually by copying the password and passwordSalt column values from another user (whose password you know). Here's some code I used: declare @u uniqueidentifierset @u = (select userid from aspnet_users where username = 'userwhosepswdyouknow') UPDATE aspnet_MembershipSET [Password] = (select password from aspnet_membership where ......

Posted On Wednesday, September 28, 2005 7:31 PM

SQL Server connection error: Not associated with a trusted SQL Server connection

This error occurs when you try to use a db login within a connection string on a server that has not been set up for mixed-mode (SQL Server and Windows security), ie when it is set to 'Windows only' authentication.

To fix this:

  1. Start Enterprise Manager,
  2. Right-click on the server and select Properties
  3. Select the Security tab.
  4. Select 'SQL Server and Windows' as the authentication mode.
  5. Click OK.

HTH

Tim

Posted On Thursday, August 18, 2005 12:45 PM

Error: MMC cannot open the file C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC.
Upon clicking on the SQL Server Enterprise Manager shortcut the following error occurs: MMC cannot open the file C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC.This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you do not have sufficient access rights to the file. The msc file did exist and I definately has permissions to it. So I can only assume it some how got corrupt. The ......

Posted On Tuesday, August 9, 2005 12:23 PM

Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net