how do I read connection string from class in asp.net c# ? also how can I read connection in my project as public in all pages? is that possible?
thanx
how do I read connection string from class in asp.net c# ? also how can I read connection in my project as public in all pages? is that possible?
thanx
if you want to use class for accessing then you can access by a public variable or by a function like
class abc
{
public static string connection_string = "your connection string";
}
class xyz
{
public string connection_string()
{
return "your connection string";
}
}
class webpage // call here at any page
{
// by using variable
string con_string = abc.connection_string;
//by using function
xyz obj_ = new xyz();
string con_string1 = obj_.connection_string();
}