LinqToSql giving 'Specified cast is not valid?

That is usually caused by a data type mismatch, e.g. If the stored procedure returns a int and that is mapped to a string, or if the stored proc return a varchar(1) and that is mapped to a System.Char.

The sproc dynamically creates a string variable and executes it. Linq doesn't like this. In order for Linq to read the return types in correctly, I have to comment it out and put in an equivalent sql statement.

Somehow this wasn't happening properly as in the designer. Cs, the return type was an int, rather that a recordset. I changed the sproc, reimported and change the sproc back to executing the string variable.

All is happy now. Thanks All! – Bill Martin Oct 22 '09 at 15:03.

Your sporc isn't actually invoked until a foreach statement is executed. Therefore, ensure that LINQ to SQL can correctly map data returned from the sproc to your objects.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions