Cannot find data access class file in App_Code folder

  • Thread starter Thread starter Alex. O. Koranteng
  • Start date Start date
A

Alex. O. Koranteng

I have a clas file in App_code folder which is being called during pag_load
to load a datatable. I am getting the error below and the code for Page_Load
is as follows
Any suggestions will be appreciated. I can email you the zipped file for the
entire project if necessary


Line 20: if (Page.IsPostBack == false)
Line 21: {
Line 22: DataTable dtData = cCommon.GetEmployees();
Line 23: this.ddlEmployee.Items.Add(String.Empty);
Line 24: foreach (DataRow drData in dtData.Rows)





Server Error in '/Chapter 5 - Update Panel' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'cCommon' does not exist in the
current context

Source Error:

Thanks
 
I have a clas file in App_code folder which is being called during pag_load
to load a datatable. I am getting the error below and the code for Page_Load
is as follows
Any suggestions will be appreciated. I can email you the zipped file for the
entire project if necessary

Line 20:         if (Page.IsPostBack == false)
Line 21:         {
Line 22:             DataTable dtData = cCommon.GetEmployees();
Line 23:             this.ddlEmployee.Items.Add(String.Empty);
Line 24:             foreach (DataRow drData in dtData.Rows)

Server Error in '/Chapter 5 - Update Panel' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'cCommon' does not exist in the
current context

Source Error:

Thanks

Hi

If I am reading your code correctly the class name is 'cCommon' and it
has a method 'GetEmployees()' that returns a DataTable.

The error suggests that the method has not been declared properly in
the code for the class causing GetEmployees() to be out of scope.
For your calling code to work the header should be something like
this:

public static DataTable GetEmployees()

Note the use of the keyword 'static' which allows the method to be
called without creating an instance of the class cCommon.

HTH
 
I have a clas file in App_code folder which is being called during pag_load
to load a datatable. I am getting the error below and the code for Page_Load
is as follows
Any suggestions will be appreciated. I can email you the zipped file for the
entire project if necessary

Line 20:         if (Page.IsPostBack == false)
Line 21:         {
Line 22:             DataTable dtData = cCommon.GetEmployees();
Line 23:             this.ddlEmployee.Items.Add(String.Empty);
Line 24:             foreach (DataRow drData in dtData.Rows)

Server Error in '/Chapter 5 - Update Panel' Application.
--------------------------------------------------------------------------- -----

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'cCommon' does not exist in the
current context

Source Error:

Thanks

It seems that cCommon class is not there. Check your book, there
should be a reference to that class
 
Alexey,


Thanks for the suggestion. I have checked my cCommon class file and the
GetEmployes method has been using declared as a Static method.
Can I email you the solution file you give me your email address.
 
Stan,

Stan,

Thanks for the suggestion. I have checked my cCommon class file and the
GetEmployes method has been using declared as a Static method.
Can I email you the solution file you give me your email address.
 
Hi Alex,
Compiler Error Message: CS0103: The name 'cCommon' does not exist in the
current context

Could you show me how and where cCommon is initialized? You can send your
project to (e-mail address removed). Please update here after sending the
project in case I missed that email.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Stan,

Stan,

Thanks for the suggestion. I have checked my cCommon class file and the
GetEmployes method has been using declared as a Static method.
Can I email you the solution file you give me your email address.

I don't hide my email address, see it above. Feel free to send me your
code, I will have a look
 
Allen,

I am sending you the project file in a few minutes. About how the cCommon
file is being initialized, I see a method shown below. I cannot find anywhere
in web.config file pointing to the Databaseconnectionstirng strg name. Could
my erroir be due to this. Not sure. Any suggestions. Please check your inbox.
The error I am getting starts with with the SimpleUpdate.aspx page and
happens for all other pages within the app. Once again, thanks for being very
supportive.

Alex
 
Back
Top