NullReferenceException in simple query.
Posted: Thu 04 Oct 2012 22:29
I am evaluating LinqConnect for use in a project. I've done a ton of Hibernate work in Java, but am just starting to familiarize myself with .NET tech.
The database is MySQL.
I have a simple case, a Player. He has an id and some other simple fields.
That works, I see a bunch of ids in the output of the Stringbuilder.
That causes a NullReferenceException on the foreach line, somewhere deep in the obfuscated code. Stopping executing before it gets called and manually inspecting the object I see the same error.
My setup is .NET 4.0, referring to:
Devart.Data, Devart.Data.Linq, Devart.Data.Linq.Vs, Devart.Data.MySql, Devart.Data.MySql.Linq. Do I need all of these references?
The version is 4.1.101, trial.
Any help would be appreciated, so far I dig this one the most of the tech I'm evaluating.
The database is MySQL.
I have a simple case, a Player. He has an id and some other simple fields.
Code: Select all
CCNWDataContext ctx = new CCNWDataContext(csb.ConnectionString);
var allPlayers = from p in ctx.Players select p;
StringBuilder sb = new StringBuilder();
foreach (var player in allPlayers)
{
sb.Append(player.ID);
sb.Append(":");
}
Code: Select all
CCNWDataContext ctx = new CCNWDataContext(csb.ConnectionString);
var allPlayers = from p in ctx.Players where p.ID==1 select p;
StringBuilder sb = new StringBuilder();
foreach (var player in allPlayers)
{
sb.Append(player.ID);
sb.Append(":");
}
My setup is .NET 4.0, referring to:
Devart.Data, Devart.Data.Linq, Devart.Data.Linq.Vs, Devart.Data.MySql, Devart.Data.MySql.Linq. Do I need all of these references?
The version is 4.1.101, trial.
Any help would be appreciated, so far I dig this one the most of the tech I'm evaluating.