see here:
http://www.connectionstrings.com/sqlconnection/using-an-user-instance-on-a-local-sql-server-express-instance/[
^]
I think
AttachDbFilename
value is in wrong format. If you still fail to connect, you can try
SSMS [
^] to connect that database file to see if anything is wrong with it.
[Update]
string connStr = @"Data Source=.\SQLEXPRESS; AttachDbFilename=C:\Users\blendy\Desktop\projekti\prova capston\capston2\capstone project\capstone project\loginforma.mdf; Integrated Security=True; User Instance=True";
SqlConnection con = new SqlConnection(connStr);
I think the above connection string will work. If it doesn't work, attach it to the sql server instance using SSMS. then try this connection string:
string connStr = @"Data Source=.\SQLEXPRESS; Initial Catalog=loginforma; Integrated Security=True; User Instance=True";