about creating a database from Visual Studio

T

Tony

Hello!

I can create a database in solution explorer in the following way.
1. Right click the project choose add new item
2. Choose a SQL Server Database
3 You get a question if you want to add the database to App_Data

When you have done this the database will also appear in the Server Explorer
that exist in Visual Studio
with extension mdf
The created database does not exist within the list of available databases
in Sql server Management Studio

I can also create a database from server Explorer in the following.
1.Right click on the Data Connection and choose Create new SQL server
Database
2.A dialog (Create New SQL Server Database) appear.
3. Choose what server for example the default server instance or perhaps the
named express instance
4.Give the database a name.
5 Now the database appear in the Server explorer with extension dbo
The created database also appear within the list of available databases in
sql server Management

Now to my question what is the difference between these two ways to create a
database ?

I mean when I used the first way the SQL server must be used even though the
database didn't appear in the list of available databases in SQl Server
Management studio.

There are some obvious differences for example.
1. I can't access the database from within SQL Server because it does not
exist here
2. In both ways I can access the database from the Server explorer

//Tony
 
T

Tony

Big Steel said:
I never use VS's SQL server functionality to create a database. I always
use SQL Server's Management Studio or I use Toad.

This wasn't what I asked about !

//Tony
 
A

Arne Vajhøj

I can create a database in solution explorer in the following way.
1. Right click the project choose add new item
2. Choose a SQL Server Database
3 You get a question if you want to add the database to App_Data

When you have done this the database will also appear in the Server
Explorer that exist in Visual Studio
with extension mdf
The created database does not exist within the list of available databases
in Sql server Management Studio

I can also create a database from server Explorer in the following.
1.Right click on the Data Connection and choose Create new SQL server
Database
2.A dialog (Create New SQL Server Database) appear.
3. Choose what server for example the default server instance or perhaps
the
named express instance
4.Give the database a name.
5 Now the database appear in the Server explorer with extension dbo
The created database also appear within the list of available databases in
sql server Management

Now to my question what is the difference between these two ways to
create a
database ?

I mean when I used the first way the SQL server must be used even though
the
database didn't appear in the list of available databases in SQl Server
Management studio.

There are some obvious differences for example.
1. I can't access the database from within SQL Server because it does not
exist here
2. In both ways I can access the database from the Server explorer

I am not a SQLServer expert, but I guess that the difference is between
a so called "user instance" database and a normal SQLServer database.

(http://msdn.microsoft.com/en-us/library/bb264564.aspx explains
what a user instance is intended for)

Arne
 
A

Arne Vajhøj

This wasn't what I asked about !

True.

But I think it is good advice.

I would also always use SQLServer Studio (or similar tool) to create
databases - normal databases - no user instance for me.

Arne
 
A

Arne Vajhøj

If I did use VS to create a SQL server database, I would just move the
MDB file to the SQL Server Data directory and do an Attach.

If using SQL Express and deploying mdb with a solution to a client as an
example, that's a different thing.

It is different.

But I would either:
- use SQLServer
- provide SQL setup scripts
- let the clients DBA create the database
or:
- use an embedded database
- let the app do everything

Arne
 
A

Arne Vajhøj

When I am talking client, I mean some mom and pop client that doesn't
have a DBA, kind of like deploying an Access database.

I would use Access or SQLServer CE or SQLite or something similar for
that context.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top