Firstly if you are dealing with EF then the lines
Code:
DataTable dbdoc = new DataTable();
//sda.Fill(dbdoc);
are pointless and can be removed.

However in your code you are also doing
Code:
 if (dbdoc.Rows.Count == 1)
which has nothing to do with the Entity Framework code and will never equal 1 as you are never loading any data into dbdoc, I suspect you should be checking if res != null but I am only really guessing.

I would suggest you take some time to get familiar with Entity Framework and the existing project before proceeding with your own modifications. If you are modifying existing code part of the process involves learning how it does things and figuring out what the best approach should be, just hacking away and trying to force your approach into an existing project is rarely going to be a success.