How do I use a class?

  • Thread starter Thread starter needin4mation
  • Start date Start date
N

needin4mation

public class FilterSQL
{
public FilterSQL(string strSQL)
{

}
private string FilteredData(string strSQL)
{

string s;
s = strSQL.Replace("\\", "\\\\");
s = s.Replace("%", "\\%"); //must come after the one for the slashes
or you get \\%
s = s.Replace("\"\"", "\\\"\""); //'same reason
s = s.Replace("'", "\\'");
return s;
}
....

I have this in a separate codebehind file. I enter
myFilter = new FilterSQL();

but it fails to compile. The class itself above compiles. I just
can't use it in my other codebehind files. How do I access it? Thank
you.
 
I'm sorry. I didn't put the variable type first:

FilterSQL myFilter = new Filter("");

However, I would like to know how to use this class in other projects.
Do I just add it with the solution explorer?
 
Where do you have this class? In a separate namespace? If so include it with
the help of using keyword at the top of the code. Or qualify the class name
with the namespace also.

public class FilterSQL
{
public FilterSQL(string strSQL)
{

}
private string FilteredData(string strSQL)
{

string s;
s = strSQL.Replace("\\", "\\\\");
s = s.Replace("%", "\\%"); //must come after the one for the slashes
or you get \\%
s = s.Replace("\"\"", "\\\"\""); //'same reason
s = s.Replace("'", "\\'");
return s;
}
....

I have this in a separate codebehind file. I enter
myFilter = new FilterSQL();

but it fails to compile. The class itself above compiles. I just
can't use it in my other codebehind files. How do I access it? Thank
you.
 
Back
Top