error: An attempt to attach an auto-named database for file C: UsersJenisha sorathiyaDocumentsstudentdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Database source: Microsoft SQL Server Database File (SqlClient)
create a new Database
log on to server with use windows authentication
then successfully created a table
write connection string in aspx.cs file:
con = new SqlConnection(“Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=C: UsersadminDocumentsstudentdb.mdf;Integrated Security=True;Connect Timeout=30 “);
error: An attempt to attach an auto-named database for file C: UsersJenisha sorathiyaDocumentsstudentdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
i am working it on my laptop it is not in UNC share and i does not have same name database
Jenisha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.