'c# database connection string issue

When the code is running. it launches fine, the form if filled out and the submit button is clicked generates a connection error. I believe it is to do with the connection credentials. Can someone tell me or confirm what the data source should be for a local machine and should the database have the .mdf after?

 SqlConnection conn = new SqlConnection("Data source=LocalDB; Database=UserData.mdf;User Id=admin; Password=123");


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source