access values of a class in other classes
Hi,
I am really confused!
I have different classes in my app_code folder
in one of my classes(below) i get the records of my config table
the table contains global necessary things like adminemail and application url
now how can i make it so that it can be accessible through other classes like this:
Dim config As New myNamspace.Config
exp:label1.Text = config.websitetitle
i am confused what to use function or sub or neither
please change the code
thankss
here is my config class
Namespace MyNamespace
Public Class Config
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Conn As New SqlConnection(ConfigurationManager.ConnectionStrin gs("Conn").ConnectionString)
Dim Cmd As New SqlCommand()
Dim dr As SqlDataReader
With Cmd
.Connection = Conn
.CommandType = CommandType.StoredProcedure
.CommandText = "setting"
End With
Conn.Open()
dr = Cmd.ExecuteReader()
While dr.Read()
websiteTitle = dr("siteTitle").ToString
applicationURL = dr("appURL").ToString
adminEmail = dr("email").ToString
End While
dr.Close()
Conn.Close()
End Sub
End Class
End Namespace
|