Hi
i have mdf file i want to attach this file to the sqlserver 2005 and when closing the program the database is detached
i connect to to master database and write the following

Code:
Dim path As String
path = My.Application.Info.DirectoryPath

pre_connect.ExecuteNonQuery("sp_attach_db 'xx','" & path & "\xx.mdf','" & path & "\xx_log.ldf';")
it gives me error message says:-
"Directory lookup for the file "C:\Documents and Settings\mokhtar\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplicati on1\bin\Debug\xx.mdf" failed with the operating system error 5(error not found)."

any help

thanks in advance.