Last post May 13, 2016 10:57 PM by mandrews1234
Nov 09, 2015 05:31 PM|mandrews1234|LINK
So I just upgraded to VS 2015, I'm getting an error that compiles fine in 2013 with a linq object. Also, even though VS throwse me a compiler error, the page itself works just fine. Here's the code that gives me the error.
Using db As New DbClassDataContext
Dim ttable As New Test
The error is that "Test" is ambiguous. Now normally that'd mean I have another variable or something named test. However, I cannot find one, this code was compiling fine until 2015, and the page runs just fine. I've tried being specific to declare it from
my dbclass.dbml file, but I can't seem to find the right syntax. Any ideas?
Nov 09, 2015 05:35 PM|Rion Williams|LINK
Try hovering over your new Test object to see if you get any intellisense in Visual Studio. Generally the ambiguous error just requires that you strongly qualify your class name as there is likely another class that is conflicting with it :
Dim ttable As New Foo.Bar.Test
Nov 09, 2015 05:50 PM|mandrews1234|LINK
That's kind of what I was trying to ask. Literally the only thing VS says is this http://i.imgur.com/IdLJEzv.png
I dug into the linq files to try and find the class names I'd need to define it like that, but I can't seem to figure out what that would be. I was hoping someone on here might know, since it's all auto generated, I'm sure there's some naming convention
I'm just unaware of.
Nov 10, 2015 04:17 AM|Klein Zhang|LINK
Ambiguous Table Name
The error "'<ClassName>' is ambiguous" is usually given when the compiler encounters two identical classes (or a class and a namespace, etc.) that are either in the same namespace, or have both been imported into your environment. So, for example, if you
had System.Data.DataTable and MyNamespace.DataTable and had imported both of them into your environment:
If after this you just referenced:
Dim dt As DataTable
Then the compiler will tell you
'DataTable' is ambiguous
because it doesn't know which one you're referring to. You need to qualify the name with either:
Dim dt As System.Data.DataTable
Dim dt As MyNameSpace.DataTable
So please check your code again.
since it's all auto generated, I'm sure there's some naming convention I'm just unaware of.
Yes. it's all auto generated, this will generate some class, for a database table, it will generate the corresponding class according to the table name, the class name and the name of the table is the same.
Nov 10, 2015 08:33 AM|mandrews1234|LINK
Sorry if I'm not being clear enough. I understand WHAT the problem is. My issue is I'm not sure how I explicitly define my class Test from my DbClasses.dbml file. It's just sitting in my app_code folder and from what I see, it doesn't have a namespace or
anything. I also don't have any class named Test.
Nov 11, 2015 03:25 AM|Klein Zhang|LINK
It's just sitting in my app_code folder and from what I see, it doesn't have a namespace or anything. I also don't have any class named Test.
It doesn't have a namespace or anything, are you sure? You could try to remove the test class from your app_code folder and create a test object then check if we could create the test class. Besides, you could click the ctr+F , and search the test in your
entire solution. I create a test class and reference it. but it's ok.
public class Test
public partial class About : Page
protected void Page_Load(object sender, EventArgs e)
Test a = new Test();
How strange things. because the reason for this problem is very clear, but we don't find the other test class.
May 13, 2016 10:57 PM|mandrews1234|LINK
So here is something even wierder. I'm now getting the same error on a different table, customer. However, I have 7 installs literally running the same code, but pointed to a different database, and it's only happening on one. All the other ones load the
page just fine. But the one, I get ambiguous name Customer. Is there something I need to clear maybe? Like temp files or something?
Edit** So killing IIS and restarting it fixed the issue. Any ideas as to what could be going on?