by Maeenul
27. January 2012 13:10
Parallel programming is not supported with Entity Framework model as the model is not thread safe. While trying to use it, different kind of error may be thrown at runtime. "The underlying provider failed on Open" and "The type has been mapped more than once." are two errors that may occur.
[More]
42053a58-79ea-482e-8d05-e9c561fbb660|0|.0
Tags:
Category: C#
by Maeenul
25. January 2012 09:29
Cannot implicitly convert type 'System.Linq.IQueryable<DBTestTool.Models.TEST>' to 'System.Collections.Generic.IList<DBTestTool.Models.TEST>'. An explicit conversion exists (are you missing a cast?) Let me explain the scenario where I got this error message. IList<TEST> tests = db.TESTs.Where(t => t.VIEW_ID == testTemplate.VIEW_ID && String.IsNullOrEmpty(t.TEMPLATE_FILE_NAME)); I have a DBContext named db and one entity is TESTS. I just want to find some specific tests that mathces with some criteria....
[More]
8b778c12-4aac-4e26-8ed8-7709f3e8a29c|0|.0
Tags:
Category: C#
by Maeenul
21. January 2012 11:58
A palindrome is a word, phrase, number, or other sequence of units that can be read the same way in either direction. Some simple example of palindrome are 1. Malayalam 2. Amma 3. Appa 4. Madam 5. Racecar To check whether a string is palindrome or not is very easy. We can create a function as follows: CREATE FUNCTION dbo.IsPalindrome (@str varchar(50)) RETURNS int AS BEGIN if REVERSE(@str) = @str return (1) return (...
[More]
by Maeenul
20. January 2012 13:43
In this post, we will see how we can find out what are the different characters available in a string and what is the number of occurrence of each individual character in the string. The first solution that comes to our mind is to use a while loop. This is very trivial solution and most of the beginners will code this way. CREATE FUNCTION dbo.AllCharacterOccurence (@str varchar(MAX)) RETURNS @tbl TABLE (chr char, freq int) AS BEGIN declare @lp as int declare @tbl2 tabl...
[More]
by Maeenul
20. January 2012 11:39
Often we need to have a sequence of integer numbers in t-sql. There are lots of ways to generate integer sequence in t-sql. You can see one solution in the following location. Integer sequence generator, Date sequence generator In this post, we will see how easily we can generate integer sequence using CTE (common table expression). This solution is very short and easy to implement. But if we need a large number of integers, i.e. 1 million numbers, then this CTE based solution will be slow and will consume a lot of memory. If we need a s...
[More]
by Maeenul
20. January 2012 05:00
by Maeenul
6. January 2012 04:44
1: IF EXISTS (SELECT * FROM dbo.sysobjects
2: WHERE id = object_id(N'[dbo].[SP_UPDATE_INFLUENCE_FACTOR]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
3: DROP PROCEDURE [dbo].[SP_UPDATE_INFLUENCE_FACTOR]
4: GO CREATE PROCEDURE [dbo].[SP_UPDATE_INFLUENCE_FACTOR]
5: @P_ID_IREA_MANAGER NUMERIC(8,0), @P_ID_PRODUCT NUMERIC(8,0),
6: @P_IS_POTENITAL NUMERIC(2,0), @P_NAC_DEN int AS
7: BEGIN UPDATE dbo.MANAGER_PROD_FACTOR SET POTENITAL=CASE @P_IS_POTENITAL
8: WHEN 1 THEN @P_NAC_DEN ELSE POTENITAL END, CONTINUOUS=CASE @P_IS_POTENITA...
[More]