CLASS PROBLEM

G

Guest

I have an object in my page

protected RProductList Rproductlist22;

public class RProductList : R_ListBase
{


public RProductList(Page Page);


public override void GenerateSQL()
{
if (base.SQL_Top == string.Empty)
{
base.SQL = this.getSQL(string.Empty);
base.SQL = this.AddOrderBySQL(base.SQL);
base.GenerateSQL();
}
}




public string getSQL(string selection);



I want to override to GenerateSQL method and want to rerun my page..

I tried

public class myclass :RProductList

{









public string coksatan;


public string CokSatan

{

get

{

return this.coksatan;

}

set

{

this.coksatan = value;


}

}




public override void GenerateSQL()

{




base.SQL = coksatan;

base.SQL = this.AddOrderBySQL(base.SQL);

base.GenerateSQL();


}

}



private void Page_Load(object sender, System.EventArgs e)

{



myclass xclass=new myclass();




xclass.CokSatan =(Rproductlist22.getSQL(string.Empty));

xclass.CokSatan=xclass.CokSatan.Replace("and
ProductPrices.ProductPrices_SellerIndex='2'","and
ProductPrices.CokSatan=1");


xclass.GenerateSQL ();


Rproductlist22 = xclass;





It doesnt seem xclass and its GenerateSQL method overrides..

It runs Rproductlist22 again.

My problem is that i want to override xclass into Rproductlist22 ..



IS there any problem with

Rproductlist22 = xclass; line ?

How can i solve it ?
 
S

Stoitcho Goutsev \(100\)

Hi,
As long as GenerateSQL is declared in the base class as virtual there
shouldn't be any problem overriding the method. You do this once in the
RProductList class. There is also nothing wrong with the line Rproductlist22
= xclass with regards to the the virtual members; that is what the virtual
methods are for.

Unfortunately I cannot tell what the problem might be from the code you
posted. You should build a test sample application that doesn't uses SQL and
stuff just for the sake of demostrating your problem and post the code here.
I believe in your case a console application sample will work just as good.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top