views:

54

answers:

1

I started with this question: (how-to-compare-liststring-to-db-table-using-linq). Using the solution offered there, it worked for my test with only 5 items in my list.

I'm having an issue with this now. I'm getting a SQL error saying "error near 0".

After using a LINQ to SQL visualizer, the problem is when Visual Studio is assigning the numbers in the list to the parameters. It will assign the first 10 just fine.

Once it hit the 11th, it jumps to the number at index 1 and assigns the same number 10 times to different params, but adding a last digit(0-9) to make each one unique. It then moves to the number at index 2 and proceeds to assign that same number multiple times.

It actually runs to the the end of the declared params, but I would imagine if there were 100 params declared it would continue.

var custdata = from c in db.CUSTs  
           where tnbrs.Contains(c.NPA + c.NXX + c.LINE_NBR)
           select new { c.PON, c.PartnerID };

What is going on here?

A: 

So apparently its the LINQ to SQL visualizer, procured from Scott Gu's blog, that has the problems with assigning the parameters correctly.

I used this class with the System.Diagnostics to log the the LINQ to SQL debug.

If you use the class above be sure to change the namespace to match the one declared in your project.

Pete