dshi15
asked on
Database Connection Class in C#
Hi Expert,
I like write a standard class to connect to database and my data entity, then i can call it in other class, how i can do it? db is working here.
Thanks in advance.
I like write a standard class to connect to database and my data entity, then i can call it in other class, how i can do it? db is working here.
Thanks in advance.
class DataConn
{
public DataConn()
{
try
{
string Conn = DBConnection.GetConnectionString("ConnectionString");
if (!string.IsNullOrEmpty(Conn))
{
using (Entities1 db = new Entities1(Conn))
{
}
}
}
catch (Exception ex)
{
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.