Sorry but I don't do VB.
>Thanks for your reply. but I try to use your method, there is some error occured.
>This is my connection string.
> Dim DataDirectory As String = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data"
>
> Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection("workstation id=DTS-1;packet size=4096;Data Source=localhost\sqlexpress;Initial Catalog=; Integrated Security=True; AttachDBFileName = '" & DataDirectory & "\DTS_AIR_DTTN.mdf'")
>
>I am sure that I have set up the database on that directory, however, when I try to compile the program, this error occured:
>
>Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DTS_AIR_DTTN.mdf". Operating system error 32: "32(error not found)".
>An attempt to attach an auto-named database for file C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DTS_AIR_DTTN.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
>
>Thank you very much!
--sb--