Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone;
I have a strange problem and that a project using LINQ TO SQL and SQL Server 2005 Express by VS2008 as my two-layer implementation. In this way the Data Layer with LINQ TO SQL worked. But the problem there is that every 10 times I run the program, the program with an error of about 3 times and 7 times runs without error. For example, some forms running time gives the following error:

The server failed to resume the transaction. Desc:3400000007

Or run the following command:

var q = from p in PData.Customers
select p.Custom_ID;

if (q.Count() != 0)
{
    :.
}


q.Count() command takes this error:

Specified cast is not valid.

Whether the problem is LINQ, which is sometimes a problem or bug is from somewhere else?

Solutions anyone knows this problem?

Thanks.
Posted
Comments
Johnny J. 29-Jun-10 10:58am    
Just an idea: could q.Count() be Null?
ehsan110121 30-Jun-10 6:02am    
Hello;
No, not null.
Thank you for your attention.

1 solution

this is all in you ASP.Net page ?
var q = from p in PData.Customers
select p.Custom_ID;

if (q.Count() != 0)
{
    :.
}

maybe this is a memory leak!try to limit source code for centralizing problem & monitor your PC memory.
shutdown Server SQL and restart.
also try to use manually Connection.Open()/Close/()Connection.BeginTransaction/... (for testing)
 
Share this answer
 
Comments
ehsan110121 30-Jun-10 6:17am    
Hello;
My program is a WindowsFormApplication and my PC memory is 2.5G.
Only 30% when this happens.
Thank you for your attention.
Adrabi Abderrahim 30-Jun-10 6:41am    
can you please! give us source code for this problem (just simple project with table that causes this problem).
I want test it, for seeing this problem in action ^_^.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900