Enabling remote debugger in visual studio

June 25, 2015

In production environment
Suppose you dont have visual studio editor. You have only dlls in the production machine. There is no code.
Along with framework you will get Remote Debugger tools in visual studio menu.

In the production machine start remote debugger tool. You will get machineno along with port no.

In development machine attach to process – Qualifier -> Enter the machineno along with portno.
in Attach to : select Automatic :Managed(v4.5,v4.0)code.
And attach to the w3p process
remote debugger


Entity Framework notes

May 24, 2015

How do I delete multiple rows in Entity Framework (without foreach)

db.People.RemoveRange(db.People.Where(x => State == “CA”));

How to delete single row in Entity Framework

use remove() method


Entity Framework notes : Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

May 3, 2015

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

try
{
// Your code…
// Could also be before try if you know the exception occurs in SaveChanges

context.SaveChanges();
}
catch (DbEntityValidationException e)
{
foreach (var eve in e.EntityValidationErrors)
{
Console.WriteLine(“Entity of type \”{0}\” in state \”{1}\” has the following validation errors:”,
eve.Entry.Entity.GetType().Name, eve.Entry.State);
foreach (var ve in eve.ValidationErrors)
{
Console.WriteLine(“- Property: \”{0}\”, Error: \”{1}\””,
ve.PropertyName, ve.ErrorMessage);
}
}
throw;
}


.Net notes : Entity Framework

May 1, 2015

‘Unable to update the EntitySet ‘xxxxxxxx’ because it has a DefiningQuery and no element exists in the element to support the current operation.’

Please check:

1. Make sure you have ”xxxxxxx” table in your datgbase

2. Make sure you have the Primary Key in that table

3. If the the table and Primary Key are existing, please updated the Entity map and publish again.


Asp.Net : Unable to make the session state request to the session state server

April 24, 2015

Asp.Net : Unable to make the session state request to the session state server

Unable to make the session state request to the session state server

That error message means the ASP.NET State service is not running in services.msc


Please select a row error popup message

April 2, 2015

In IE 11
if you are getting “Please select a row” error pop up message then u have to check the below solution.

Tools – >Compatibility View settings ->

uncheck the checkbox of “Display intranet sites in Compatibility View”

Please select a row


SqlServer notes : sqlserver script to find a string in entire database

April 1, 2015

http://www.sqlmatters.com/Articles/Searching%20all%20columns%20in%20all%20tables%20in%20a%20database.aspx

DECLARE @SQL VARCHAR(MAX)
DECLARE @SearchString VARCHAR(100)
SET @SQL=”

— ——————————————
— Enter the string to be searched for here :

SET @SearchString=’bracket’
— ——————————————

SELECT @SQL = @SQL + ‘SELECT CONVERT(VARCHAR(MAX),COUNT(*)) + ” matches in column ”+”’
+ C.name + ”’+” on table ” + ”’ + SC.name + ‘.’ + T.name +
”’ [Matches for ”’+@SearchString+”':] FROM ‘ +
QUOTENAME(SC.name) + ‘.’ + QUOTENAME(T.name) + ‘ WHERE ‘ + QUOTENAME(C.name) +
‘ LIKE ”%’ + @SearchString +
‘%” HAVING COUNT(*)>0 UNION ALL ‘ +CHAR(13) + CHAR(10)
FROM sys.columns C
JOIN sys.tables T
ON C.object_id=T.object_id
JOIN sys.schemas SC
ON SC.schema_id=T.schema_id
JOIN sys.types ST
ON C.user_type_id=ST.user_type_id
JOIN sys.types SYST
ON ST.system_type_id=SYST.user_type_id
AND ST.system_type_id=SYST.system_type_id
WHERE SYST.name IN (‘varchar’,’nvarchar’,’text’,’ntext’,’char’,’nchar’)
ORDER BY T.name, C.name

— Strip off the last UNION ALL
IF LEN(@SQL)>12
SELECT @SQL=LEFT(@SQL,LEN(@SQL)- 12)

EXEC(@SQL)

–PRINT @SQL


Follow

Get every new post delivered to your Inbox.