Another simplest way to connect is through an OdbcConnection using App.config file like this
<appSettings>
<add key="Conn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|MyDB.mdb;Persist Security Info=True"/>
</appSettings>
MyDB.mdb is my database file and it is present in current primary application folder with main exe file.
if your mdf file has password then use like this
<appSettings>
<add key="Conn" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|MyDB.mdb;Persist Security Info=True;Jet OLEDB:Database Password=Admin$@123"/>
</appSettings>