Thanks for Reply.
your solution worked but it make an aditional database that we set it's name in predefinedconnectiondlg.
that sounds not good. is there a way to attach the db without create additional db. i Think i because of this option you noticed:
please give me a solution that attach db without create additional db.go to "SQL Databases" page --> "DlgPredefinedConnection" --> in the "Database" field, change the database name from "TestDb" to another name (this is required because your script already creates a database with that name)
check the "Create database if it does not exist" option
thanks