Question Locked

how to create sqlserver database at runtime using vb.net

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
plz replay soon

3 replies

by tony hopkinson

Open a connection to the Master Database with a user with the create databases privilege.
Exec a query on the connection with CREATE DATABASE... in it.

Normally only the sa would be able to create databases, given on most setups that's windows admin, it's likely that the user won't know that password. You could give create database to all and sundry, or you could set up for mixed mode, and set up a SQL user / password with the privilege.

Oh and we haven't gone near setting up the users, tables, sps, functions, permissions....

You can get round all this crap eventually, but when you have and you release version two which requires an updated schema, then you have pain.

Don't do this unless you really really really have to.

This discussion is closed to new replies.