Entity Framework: There is already an open DataReader associated with this Command

It is not about closing connection. EF manages connection correctly. My understanding of this problem is that there are multiple data retrieval commands executed on single connection (or single command with multiple selects) while next DataReader is executed before first one has completed the reading. The only way to avoid the exception is to allow … Read more

SET versus SELECT when assigning variables?

Quote, which summarizes from this article: SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise … Read more

Connect different Windows User in SQL Server Management Studio (2005 or later)

While there’s no way to connect to multiple servers as different users in a single instance of SSMS, what you’re looking for is the following RUNAS syntax: runas /netonly /user:domain\username program.exe When you use the “/netonly” switch, you can log in using remote credentials on a domain that you’re not currently a member of, even … Read more

How do I find a stored procedure containing ?

SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE ‘%Foo%’ AND ROUTINE_TYPE=’PROCEDURE’ SELECT OBJECT_NAME(id) FROM SYSCOMMENTS WHERE [text] LIKE ‘%Foo%’ AND OBJECTPROPERTY(id, ‘IsProcedure’) = 1 GROUP BY OBJECT_NAME(id) SELECT OBJECT_NAME(object_id) FROM sys.sql_modules WHERE OBJECTPROPERTY(object_id, ‘IsProcedure’) = 1 AND definition LIKE ‘%Foo%’

Select statement to find duplicates on certain fields

To get the list of fields for which there are multiple records, you can use.. select field1,field2,field3, count(*) from table_name group by field1,field2,field3 having count(*) > 1 Check this link for more information on how to delete the rows. http://support.microsoft.com/kb/139444 There should be a criterion for deciding how you define “first rows” before you use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)