Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

April 20, 2010

Requiem to the VS 2003/2005/2008 Database Project

Filed under: C#,VB.NET @ 12:16 am

Sometimes a tool comes along that is so demure yet so useful and easy to use, it is very hard to say good-bye. But our easy breezy Database project from Visual Studio 2003, Visual Studio 2005, and Visual Studio 2008 is now gone. It was replaced with a new young tool that is more full-featured, more complex, and somewhat aloof: the new Database project in VS 2010.

Several up-coming posts will detail the new tool. This post celebrates the life and times of the old tool, paying our last respects.

If you are not familiar with the old Database project, it was a Visual Studio project type that you could add to any solution. Here is the dialog in VS 2008. (It looks similar in VS 2005 and VS 2003.)

image

After clicking OK, you could define the connection associated with the Database project.

image

You could select one of the connections defined in the Server Explorer, or click Add New Reference to define a new connection.

The purpose of the Database project was simply to hold your database scripts. You could easily add any database script to this project, such as a create table script or stored procedure script. You could then check these scripts into a source code control system along with the other source code in your solution.

Once you added a  Database project to your solution, the Server Explorer got additional options:

image

You could right-click on a table, stored procedure, or any scriptable object in Server Explorer, select Generate Create Script to Project, and the script for the selected object was automatically added to the Database project in your solution.

The Database project shown below has both a Customer table script and a CustomerRetrieveAll stored procedure script.

image

Once you had the scripts in your project, you could create new scripts or edit existing scripts like any other code files. This feature was especially useful for creating and editing stored procedure scripts.

Then you could select one or more scripts in Solution Explorer, right-click, and select Run to run the scripts against the database defined as the default under the Database References.

So in just a click or two in Server Explorer you could generate the script for any database object to your project. You could then work with the scripts like any other solution file. And with just a click or two on the Database project files in Solution Explorer, you could apply the scripts back to the database.

Simple and effective. Unintimidating and useful. You will be missed.

Enjoy!

8 Comments

  1.   D. Lambert — April 20, 2010 @ 7:56 am    Reply

    Aaaacckk!!! I’m busting my knuckles trying to get the VS2008 DB Project to do what I want it to do — please, please, please tell me I’m not wasting my time!

    I really hope the VS2010 stuff is an improvement on what’s in VS2008. There’s a lot of promise here, but I’m constantly running into little gotcha’s. I really hope the new stuff is better, but this obit has made me a little nervous — I really hope I’m not going to have to start all over….

    (btw, the captcha image for commenting doesn’t show up in Chrome … no idea why)

  2.   DeborahK — April 20, 2010 @ 7:56 pm    Reply

    Hi D. Lambert –
    Are you using the Database Project as described here (under “Other Project Types” in the first screen shot)? Or those under “Database Projects”?

  3.   D. Lambert — April 22, 2010 @ 12:35 pm    Reply

    I’m using the SQL database projects from VS2008 — not the one under “other”.

    I hadn’t realized there was any difference.

  4.   Thomas Wolfram — April 24, 2010 @ 11:28 am    Reply

    Well, I won’t miss it. It was just another way to group SQL scripts. But no support for schema versioning. You were on your own writing deployment scripts to alter schemas of existing installations. So in the end 3rd party tools were required for serious projects.

    I used the new DB project type since the VS 2008 GDR R2 update came out and it’s a milestone.

  5.   VG — April 26, 2010 @ 7:05 am    Reply

    I too hope there are some improvements. I have been using the db projects religiously. But there are a lot of pain points, including the fact that the db project runs the “analyze” utility whenever it likes, not caring if I’m in the middle of trying to update multiple SPs and I have to wait for it to finish before I can do ~my~ work. That utility should only run when I tell it to! Performance of compiling one of these projects can be painful too.

  6.   Prof — April 26, 2010 @ 8:18 pm    Reply

    Wow here’s this cool thing you can do, oh wait no you can’t do that anymore.

    Thanks for the history lesson.

    How about a follow up article on how to make easy DB projects with VS2010?

    (Intentionally fecitious)

  7.   DeborahK — April 27, 2010 @ 4:06 pm    Reply

    Hi Prof –

    Yea, the follow up posts are coming. Was planning to do them this week-end but spent most of Saturday in the emergency room again and then Sunday my spouse got the chickenpox, so I have been otherwise distracted.

    I will get them up as soon as I possibly can.

    Thank you so much for your interest!

  8.   Tsuna — September 26, 2012 @ 9:53 am    Reply

    What would many of us do devoid of the briillant tips you write about on this blog? Who comes with the tolerance to deal with vital topics just for common readers like me? My spouse and i and my friends are very happy to have your blog among the kinds we frequently visit. We hope you know how significantly we appreciate your hard work! Best wishes coming from us all.

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2014 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs