data source=.\SQLEXPRESS;Initial File Name=|DataDirectory|ASPNET.mdf;Integrated Security=SSPI;User Instance=true
i am using above connection string. It is working fine. But when change data source “.\SQLEXPRESS” to “localhos” it raise error “Invalid value for key ‘attachdbfilename'”.
And my second question, what is the use of keyword “User Instace”.
You can use
serverinstead ofdata sourceto get connected locally:The use of user instance is to make fully previlaged SQL Server instance to a user with limited administrative previlaged on the computer.