while digimanus is completely correct except for a missing l, I feel you need a little explanation why.
try
{
}
catch(Exception e)
{
}
When code are executed in your try-block and then throws an exception then the rest of the code in the try-block are skipped (including a return statement) and then the code in the catch-block is executed, so if you do not have a return statement in or after the catch-block the compiler doesn't know what should be returned.
I'll try to give you an example, read my comments in the code:
public DataTable login(string Username, string Password)
{
try
{
string sqlstr;
sqlstr = "SELECT * FROM Login WHERE Username = '" + Username + "' AND Password = '" + Password + "' ";
con = new SqlConnection(clsConnection.strconnection);
con.Open();
da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand();
da.SelectCommand.CommandText = sqlstr;
da.SelectCommand.Connection = con;
da.SelectCommand.CommandType = System.Data.CommandType.Text;
da.SelectCommand.ExecuteNonQuery();
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}