If you are using Visual Studio it shows you the connection string on the properties window for that connection. Go to server explorer and click on your connection. You will see it’s details on the right pane.
Here is an example though:
Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\SQL\DBS\tesdb.mdf;Integrated Security=True;Connect Timeout=30