Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A Little Help
Message
De
12/06/2003 01:07:18
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
A Little Help
Divers
Thread ID:
00799237
Message ID:
00799237
Vues:
44
Hi All,

I having a problem which I'm hoping someone can help me with.

I'm using ASP.NET(C#) and I want a function to only execute on a specific page.

I've tried this.
void Page_Load(object sender, EventArgs e){
 if(Request.ServerVariables["SCRIPT_NAME"].Replace("/", "").Trim() == "test.aspx"){
  Build_Function2();
 }
}
It works on the page test.aspx but any other page it still seems to load the function and displays an error.

Here is the function
void Build_Function2(){
	OleDbConnection myConnection = new OleDbConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
	OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM Pages WHERE AreaID = 9 AND Main <> 1 ORDER BY Title;", myConnection);

	DataSet ds = new DataSet();
	myCommand.Fill(ds, "Pages");

	MyHosting.DataSource = ds.Tables["Pages"].DefaultView;
	MyHosting.DataBind();
}
Does Anybody Know What I am doing wrong?

Thanks Guys,

Kind Regards,
Tarran Walker
tarran.walker@reliez.com.au
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform