473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

denotes a class which is not valid in the current context

I create a class which would hold my static methods (methods I want to call
without having to instantiate the class). I then attempted to use it in
another class and I get the following error
"GenericDataBase.DataUtilities(cmd, "Stuff") denotes a class which is not
valid in the current context. What does this mean?

Here is the class that I created....

public class DataUtilities
{
public DataUtilities()
{
}
public static string ListParmValues(IDbCommand cmd, string breakCharacter)
{

StringBuilder vals= new StringBuilder();
......
return vals.ToString();
}
}

Here is the code in the "other" class that I am calling...

string val = GenericDatabaseBase.DataUtilities(cmd, "<br>");
Nov 19 '05 #1
3 1532
in which method/event your calling listparamvalues methods?

Cheers
Vadivel Kumar
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
I create a class which would hold my static methods (methods I want to call
without having to instantiate the class). I then attempted to use it in
another class and I get the following error
"GenericDataBase.DataUtilities(cmd, "Stuff") denotes a class which is not
valid in the current context. What does this mean?

Here is the class that I created....

public class DataUtilities
{
public DataUtilities()
{
}
public static string ListParmValues(IDbCommand cmd, string breakCharacter)
{

StringBuilder vals= new StringBuilder();
......
return vals.ToString();
}
}

Here is the code in the "other" class that I am calling...

string val = GenericDatabaseBase.DataUtilities(cmd, "<br>");

Nov 19 '05 #2
Looks like you forgot to call the method. In you code you have just name of
class and not method.
Shimon.

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
I create a class which would hold my static methods (methods I want to call
without having to instantiate the class). I then attempted to use it in
another class and I get the following error
"GenericDataBase.DataUtilities(cmd, "Stuff") denotes a class which is not
valid in the current context. What does this mean?

Here is the class that I created....

public class DataUtilities
{
public DataUtilities()
{
}
public static string ListParmValues(IDbCommand cmd, string breakCharacter)
{

StringBuilder vals= new StringBuilder();
......
return vals.ToString();
}
}

Here is the code in the "other" class that I am calling...

string val = GenericDatabaseBase.DataUtilities(cmd, "<br>");

Nov 19 '05 #3
This is assuming GenericDataBase is your namespace.

In your other class

GenericDatabaseBase.DataUtilities.ListParmValues(c md, "<br>");

What the error means is you have a class named DataUtilities. You have
tried to call the class as a method. You need to include the actual method
name to get rid of this error.

Imagine if you have two static methods inside your class, how would it know
what method you are calling.

HTH,

bill
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
I create a class which would hold my static methods (methods I want to call without having to instantiate the class). I then attempted to use it in
another class and I get the following error
"GenericDataBase.DataUtilities(cmd, "Stuff") denotes a class which is not
valid in the current context. What does this mean?

Here is the class that I created....

public class DataUtilities
{
public DataUtilities()
{
}
public static string ListParmValues(IDbCommand cmd, string breakCharacter)
{

StringBuilder vals= new StringBuilder();
......
return vals.ToString();
}
}

Here is the code in the "other" class that I am calling...

string val = GenericDatabaseBase.DataUtilities(cmd, "<br>");

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: KAnoe | last post by:
This is the Error msg that I get. The dieroll is a DLL that I have that has been referenced. Error Msg: 'dieroll' denotes a 'namespace' which is not valid in the given context This is the...
5
by: Filip | last post by:
Hello, (ASP.NET c#) I want to put some common functions into one class and within this class I need to have access to the Session, Request and Response. This class is not page behind file! I...
8
by: bidllc | last post by:
I have a funtion that works fine and dandy when called from anywhere in my app. It will NOT work when called from inside the class in which it resides. This is the function I'm calling:...
6
by: Vladislav Kosev | last post by:
I have this strange problem now twice: I am writing this relatevely large web site on 2.0 and I made a static class, which I use for url encoding and deconding (for remapping purposes). This static...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.