Is there nay way that my application could create a new instance (say MyInstance) and attach my DB to that, with sa password?
Please give me vb.net code for it if possible.
Thanks a lot.
I don't think so! You can only create an instance through SQL Server installation, there is no code for that.
The attachment yes can be done through code, you just need to add FOR ATTACH on your CREATE DATABASE command.
Can you share why you want to create a new instance? I don't see why this would be necessary on a application.