Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > denotes a class which is not valid in the current context

Reply
Thread Tools

denotes a class which is not valid in the current context

 
 
=?Utf-8?B?SmltIEhlYXZleQ==?=
Guest
Posts: n/a
 
      02-21-2005
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>");
 
Reply With Quote
 
 
 
 
Vadivel Kumar
Guest
Posts: n/a
 
      02-21-2005
in which method/event your calling listparamvalues methods?

Cheers
Vadivel Kumar


"Jim Heavey" <> wrote in message
news:76D5C627-EE11-45CC-8595-...
>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>");



 
Reply With Quote
 
 
 
 
Shimon Sim
Guest
Posts: n/a
 
      02-21-2005
Looks like you forgot to call the method. In you code you have just name of
class and not method.
Shimon.

"Jim Heavey" <> wrote in message
news:76D5C627-EE11-45CC-8595-...
>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>");



 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      02-21-2005
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" <> wrote in message
news:76D5C627-EE11-45CC-8595-...
> 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>");



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error:denotes a 'field' where a 'class' was expected Ignacio Machin \( .NET/ C# MVP \) ASP .Net 0 03-02-2007 03:35 PM
'System.Web.Caching.Cache' is a 'type', which is not valid in the given context ?? Harry Haller ASP .Net 4 02-23-2007 03:25 PM
How to retrieve a session Bean in the Context in a class with the Context reference asd Java 1 11-09-2006 05:00 PM
System.Data.SqlClient.SqlCommand.Parameters' denotes a 'property' where a 'method' was expected erro Patrick Olurotimi Ige ASP .Net 2 02-08-2005 11:22 AM
What denotes a CCD defect? Gareth Crawshaw Digital Photography 9 12-01-2004 02:11 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57