mysterious compile error, method which exists isn't found

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 3.5

The second line in the code below generates a compile error:
'Car' does not contain a definition for 'GetCar'

long id = Convert.ToInt64(Request.QueryString["id"].ToString());
Car car = Car.GetCar(id);

this happens inside an .aspx webpage, Car is a class in the BLL layer, the
code above is in the Page_Load on the webpage. Above this code I'm having
"using me.carspace.BLL;"

But the GetCar method exists in the Car class, I've used this code from
another webpage without any trouble. (only difference is that this page
don't have any masterpage, I don't see how that can make the problem)

This is the signature for GetCar:
public static Car GetCar(long id)

When I in the Page_Load event type "Car." then the intellisense suggest
"GetCar" but I get compile error when using it.

This .aspx webpage is located in the root folder

I don't see how this can be a reference problem, as all the classes are
inside this webproject and at the top of this .aspx.cs file I referecing the
BLL class ("using me.carspace.BLL;")

any ideas what's wrong here?
 
Jeff said:
hi

asp.net 3.5

The second line in the code below generates a compile error:
'Car' does not contain a definition for 'GetCar'

long id = Convert.ToInt64(Request.QueryString["id"].ToString());
Car car = Car.GetCar(id);

this happens inside an .aspx webpage, Car is a class in the BLL layer, the
code above is in the Page_Load on the webpage. Above this code I'm having
"using me.carspace.BLL;"

But the GetCar method exists in the Car class, I've used this code from
another webpage without any trouble. (only difference is that this page
don't have any masterpage, I don't see how that can make the problem)

This is the signature for GetCar:
public static Car GetCar(long id)

When I in the Page_Load event type "Car." then the intellisense suggest
"GetCar" but I get compile error when using it.

This .aspx webpage is located in the root folder

I don't see how this can be a reference problem, as all the classes are
inside this webproject and at the top of this .aspx.cs file I referecing
the BLL class ("using me.carspace.BLL;")

any ideas what's wrong here?

The method is not in the namespace you think it is? So, it can't be found?


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4142 (20090609) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
I've solved it, I had another .aspx webpage in the same folder with the name
Car, so I solved it by referencing the Car class by me.carspace.BLL.Car


Mr. Arnold said:
Jeff said:
hi

asp.net 3.5

The second line in the code below generates a compile error:
'Car' does not contain a definition for 'GetCar'

long id = Convert.ToInt64(Request.QueryString["id"].ToString());
Car car = Car.GetCar(id);

this happens inside an .aspx webpage, Car is a class in the BLL layer,
the code above is in the Page_Load on the webpage. Above this code I'm
having
"using me.carspace.BLL;"

But the GetCar method exists in the Car class, I've used this code from
another webpage without any trouble. (only difference is that this page
don't have any masterpage, I don't see how that can make the problem)

This is the signature for GetCar:
public static Car GetCar(long id)

When I in the Page_Load event type "Car." then the intellisense suggest
"GetCar" but I get compile error when using it.

This .aspx webpage is located in the root folder

I don't see how this can be a reference problem, as all the classes are
inside this webproject and at the top of this .aspx.cs file I referecing
the BLL class ("using me.carspace.BLL;")

any ideas what's wrong here?

The method is not in the namespace you think it is? So, it can't be found?


__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4142 (20090609) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
I've solved it, I had another .aspx webpage in the same folder with the name
Car, so I solved it by referencing the Car class by me.carspace.BLL.Car



Jeff said:
hi
asp.net 3.5
The second line in the code below generates a compile error:
'Car' does not contain a definition for 'GetCar'
long id = Convert.ToInt64(Request.QueryString["id"].ToString());
Car car = Car.GetCar(id);
this happens inside an .aspx webpage, Car is a class in the BLL layer,
the code above is in the Page_Load on the webpage. Above this code I'm
having
"using me.carspace.BLL;"
But the GetCar method exists in the Car class, I've used this code from
another webpage without any trouble. (only difference is that this page
don't have any masterpage, I don't see how that can make the problem)
This is the signature for GetCar:
public static Car GetCar(long id)
When I in the Page_Load event type "Car." then the intellisense suggest
"GetCar" but I get compile error when using it.
This .aspx webpage is located in the root folder
I don't see how this can be a reference problem, as all the classes are
inside this webproject and at the top of this .aspx.cs file I referecing
the BLL class ("using me.carspace.BLL;")
any ideas what's wrong here?
The method is not in the namespace you think it is? So, it can't be found?
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4142 (20090609) __________
The message was checked by ESET NOD32 Antivirus.

Yes, it can happen. Avoid using class names that duplicate names of
other classes or commonly used .NET Framework namespaces.
 
Back
Top