I am calling this method to my Login Form. I don't know what is wrong with this. I've created a class named MyConnection and this class contains my SQL ConnectionString. What i want is I can call this function ex. Class1 method named Myfunction would be called to my Login Form so calling a connection string would be faster.
public static class MyConnection
{
public static SqlConnection getConnection()
{
string conn = "Data Source=EDGAR-PC\\SQLEXPRESS;Initial Catalog=Project1;Integrated Security=True";
SqlConnection myConn = new SqlConnection(conn);
return myConn;
}
}