Basically based on a database entry, I want to dynamically build the %26lt;TITLE%26gt; tag.
Thanks for answering!
Using Visual Studio's C#, how can I adjust the %26lt;TITLE%26gt; tag in the HTML?
Between my TITLE tags I would put reference to a subroutine in my script header for example
%26lt;TITLE%26gt;%26lt;%MySubName%%26gt;%26lt;/TITLE%26gt;
Then in my header I would run my database code to call my title and then use response.write to generate the title within the tags - for example
Import the namespace System.Data.OleDb.
public void mySubName(Object s, EventArgs e) {
{
OleDbConnection conn;
OleDbCommand comm;
OleDbDataReader dr;
conn = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\\database.mdb");
comm = new OleDbCommand("Select titlecolumn from mytable",conn);
conn.Open();
dr = comm.ExecuteReader();
while (dr.Read())
{
Response.Write( dr["titlecolumn"].ToString() );
}
dr.Close();
conn.Close();
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment