You can also manually download the Microsoft public symbols:
Note that the this procedure will only work if you have already set a local symbols cache location as per the first procedure.
To setup a third party symbol server with Visual Studio:
http://domain/path/symbols serverpathsymbols c:pathsymbolspublic partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void SimpleStoredProcedure(SqlString name)
{
using (SqlConnection sqlConn = new SqlConnection("context connection=true"))
{
String sqlStr = string.Format("Insert into [TableName] (FieldName, ...) values ('{0}', ...)", name);
SqlCommand cmdObj = new SqlCommand(sqlStr, sqlConn);
try
{
sqlConn.Open();
cmdObj.ExecuteNonQuery();
}
catch (Exception ex)
{
}
}
}
};
exec SimpleStoredProcedure 'testname1' select * from [TableName] where [FieldName] = 'testname1'
For more info on SQL/CLR debugging: http://msdn.microsoft.com/en-us/library/ms165051(VS.80).aspx
]]>Method 1
Method 2
Method 3
For more on how to disable JavaScript debugging, please see http://blogs.msdn.com/greggm/archive/2009/04/06/disabling-script-debugging-in-vs-2008-ie8.aspx
]]>As a DBA, you will be responsible for managing several of the SQL Server instances; some of which may have similar setup and configuration while the other might be having completely different setup and configuration. On each instance there might be some server level objects for which you would like to maintain a change history (version control) or would like to easily recover the master database easily in case of failure.
Microsoft Visual Studio 2010 (not all editions, see note below for more details) allows to creation and configuration of a server project as an offline representation of your master database, which you can add to VSTF (Visual Studio Team Foundation) for version control or to maintain change history. This reduces the risk of overwriting the offline representation, improves the communication among developers and helps you in maintaining and recovering your SQL Server instance .
Microsoft Visual Studio 2010 provides several templates for database project development such as Database Project, Database Project Wizard, Server Project, Server Project Wizard, Data tier application. In this article, I am will discuss creating SQL Server projects using Server Project / Server Project Wizard template.
Note:
|
Launch Visual Studio IDE by going to START -> Programs -> Microsoft Visual Studio 2010 and then go to File -> New and you will see a screen as below.
In the New Project dialog box, select SQL Server under Database in the left side tree view and the select SQL Server 2008 Server Project (or SQL Server 2005 Server Project depending on your SQL Server version). Specify the name of the project, location and solution name as shown above and click on OK which will bring up the welcome screen below.

Click on the Next button to move on to the next screen as shown below:

In the above screen you can specify some of the properties of the project you are creating, for example you can specify whether you want to create a database project (for user databases) or SQL Server project (choose server project as we are creating a project for SQL Server master database), how you want you script files to be created, whether it should be created by schema or by the type of database objects. Next you can specify to include the schema name in the script files being created. Click on Next button to continue to the below screen:

In the above screen you specify different SQL Server instance level options (for example ANSI paddings, ANSI nulls, Arithmetic abort etc. to be either ON or OFF by default), master database default collation and default schema. Click Next to move on to the next screen:

In this screen you need to specify the source server connection from where you want to import master database schema objects (if a connection is already available you can select it from the combo-box, if you want to modify an existing connection click on Edit Connection or click on New Connection if you want to create a new connection), along with that you can also specify the different import options which will be used during the import and the number of maximum files (the script for each database object is saved in a single file) in a one directory. Click Next to move on to the next screen which is shown below:

In this screen, specify the different options which will be used when you build and deploy your project to a SQL Server instance. For example, specify the target server connection string (you may notice here that the target database name box is disabled and it has an entry for the master database as this is a server project), whether the collation of the project will be used or a default collation of the server will be used etc. . Click Finish to start creating the project, as shown in the progress screen below:

If there are any problems while creating project and importing the master database schema objects, the above screen will display the error message or else click on Finish button to close the wizard and return to the IDE. Here you can see your created server project (for the master database) along with all the schema objects in it.

Above you can see objects in Solution explorer view, below is what you will see when you select Schema view where each schema contains all the objects owned by it and organized under it.

You can double click on the any of the object to open it in editor where you can modify it. If you want to add a new object, simply right click on the folder and click on Add (in Solution Explorer right click on the folder, click on the type of object you want to create or simply click on New Item to specify the type of object in another dialog box). I will be demonstrating to create an object in the next section.
Right click on the project in Solution Explorer and select Properties to configure different deployment properties. To configure the different deployment properties, click the Deploy page on the left side and you will see a screen as below:

In this screen you can specify different properties, for example whether you want to just create a deployment script or you want to create a deployment script and also deploy it, the name of the deployment script file, the target server connection string and since this is a server project the master database name is already available in the target database name textbox (disabled).
Once you are done with the configuration, you can build your project by selecting the Build option in the Menu bar (or by simply hitting F6 key) or build and deploying by using Deploy option in Menu bar as shown below:

Let’s do some changes in the project and see the impact on the server after deployment. Right click on the project and click on “Add New Item” and then select an object type to be created, specify an appropriate name and then click the Add button. Since I am creating a SQL login I selected Login (Sql Server) type as shown below:

You can double click on the newly created object to open it in the editor and make the required changes, if any, as you can see in the image below:

Finally you can deploy your changes by following the steps as discussed above and then you can go to the SQL Server instance to verify your changes as shown in the image below where I created a SQL login under the Logins node.

In this article, I showed you how you can use Microsoft Visual Studio 2010 ultimate edition to create an offline representation of your master database by creating a SQL Server project in it. Then I showed you how you can make changes to this offline representation and deploy these changes to the SQL Server instance.
]]>Prior to Microsoft Visual Studio 2005, managing database projects had been a real challenge. Microsoft Visual Studio 2005 Database Professional Edition (also known as Data dude) simplified this process and Microsoft Visual Studio 2008 Database Edition GDR 2 further, along with several bug fixes, enhanced its capability to support newest feature of SQL Server 2008. New release i.e. Microsoft Visual Studio 2010 brings a whole lot of new features and enhancements compared to its earlier versions. For example, you can now connect to SQL Server from Visual Studio IDE (Integrated Development Environment) itself with new in-built T-SQL Editor without actually going to SQL Server Management Studio (SSMS), you will get T-SQL Intellisence support while writing or modifying your T-SQL code etc.
Microsoft Visual Studio 2010 (not all editions, see note below for more details) allows to create and configure a database or server project as offline representation of your user databases or master database, which you can add to VSTF (Visual Studio Team Foundation) for version control and collaborative development. This reduces the risk of overwriting the offline representation, improves the communication among developers and helps your database development process to be become a part of regular software development life cycle.
Microsoft Visual Studio 2010 provides several templates to work with database development. For example Database Project, Database Project Wizard, Server Project, Data tier application etc. In this article, I am going to discuss about creating database project using Database Project and Database Project Wizard templates for user databases. Rest I will be talking of in the next couple of articles.
| Note: I am using Microsoft Visual Studio 2010 Ultimate edition RTM for all these examples and demonstration though database project development is supported in couple of other editions as well. To learn more about edition wise supported features click here. |
Launch Microsoft Visual Studio 2010 IDE (Integrated Development Environment) by going to START -> Programs -> Microsoft Visual Studio 2010 and then go to File -> New and you will see a screen like this. You can choose here to create a blank project and add/import database schema objects later on after project creation or choose to initiate a wizard which will walk you through importing database objects as part of project creation.
Once a project is created, if required, you can right click on the project and import scripts from one or more files into the project.
In the New Project dialog box, select SQL Server under Database node in the left side tree view and the select SQL Server 2008 Wizard (or SQL Server 2005 Wizard depending on your database version). Specify the name of the project, location and solution name for this database project in their respective text boxes as shown above and click on OK button which will bring up a New Database Project Wizard welcome screen as shown below.

Simply click on the Next button to move on to the next screen as shown below:

In the above screen you can specify some of the properties of the project you are creating, for example you can specify whether you want to a create database project for user database or SQL Server project for master database (choose database project as we are creating a project for user database development), how do you want you script files to be created, it should be created by schema name or by the type of database objects. Next you can specify to include schema name in the script files being created. Click on Next button to move on to the next screen which is shown below:

In the above screen you can specify different user database level options (for example ANSI paddings, ANSI nulls, Arithmetic abort etc. to be either ON or OFF by default), user database default collation and default schema. Click on Next button to move on to the next screen which is shown below:

In the above screen you specify the source database connection from where you want to import user database schema objects (if a connection already available you can select it from the provided combo-box, if you want to modify an existing connection click on Edit Connection button or click on New Connection if you want to create an altogether new connection), along with that you can also specify the different import options which will be used during importing database objects and number of maximum files (the script for each database object is saved in a single file) in a one directory. Click on Next button to move on to the next screen which is shown below:

In the above screen you specify different options which will be used when you build and deploy your database project to a SQL Server instance. For example you specify the target server connection string and target database name, whether the collation of the project will be used or default collation of the server will be used instead for the user database etc. I will be talking more about deployment options later when I will demonstrate how to deploy your database project in the next section. Click on Finish button to start creating the project, next screen will display the progress as shown below:

If there is any problem while creating database project and importing database schema objects, the above screen will display the error message or else click on Finish button to close the wizard and return to the IDE. Here you can see your created database project along with all the schema objects in it.

You can switch between Solution Explorer view and Schema view using the small icons in the top row of explorer as shown below:

Above you saw objects in Solution explorer view, below is the what you will see when you switch to Schema view where each schema contains all the objects owned by it/organized under it.

You can double click on the any of the object to open it in editor where you can modify it as per your need, for example as shown below for a table. If you want to add a new object, simply right click on the folder and click on Add (in Solution Explorer right click on the folder, click on the type of object you want to create or simply click on New Item to specify the type of object in another dialog box).

You can notice that the above script only contains table creation part (for [HumanResources].[Department] table) and does not have script to create primary key as shown in Schema View on the right side for the same table. The reason is, primary key in itself is an object and hence it has been placed in separate file (double click on it to open it) as you can see below:

Let me show you how you can create a new database object. Right click on Project and click on –> New -> New Item, you will see a screen like this.
In the above screen I am creating a view and selected the View template out of all the available templates and provided its name in the Name textbox. This will bring up an editor window as shown below where you can write code for your view.
In the above screen you can see the Intellisence feature in action. Good part about Intellisense feature is, it works both in project mode (offline representation of the database) when not connected to the server and in connected mode when connected to the server.
Microsoft visual Studio 2010 also includes T-SQL editor in the IDE itself as you can see below, so you don’t need to go to SSMS (SQL Server Management Studio) to connect to server and work, simply connect to the server from IDE itself and you are ready to browse through databases and database objects.
You can open up a new query window using “New Query” and write and execute your query as shown below:
Before deployment you need to configure different deployment properties and build the project. Right click on the project node in Solution Explorer (or press ALT+Enter) and select Properties to configure these properties. Click on Deploy page on the left side and you will see a screen like this:
In the above screen you can specify different properties, for example whether you want just to create a deployment script or want to create a deployment script and also deploy it, what would be name of the deployment script file which will be created, target server connection string and the target database name in the respective textbox.
Once you are done with these configurations, you can build your project by using Build option in Menu bar (or by simply hitting F6 key) or simply build and deploy by using Deploy option in Menu bar as shown below:
Once deployed you can connect to the server and verify it as shown below:
In this article, I showed you how you can use Microsoft Visual Studio 2010 ultimate edition to create offline representation of user database by creating a database project in it. Then I showed you how can make changes to this offline representation and deploy these changes to the SQL Server instance.
]]>Developers building apps for large enterprises often encounter the problem that the data required to be pulled into the app exists in numerous different repositories such as SQL Server databases, SharePoint, SQL Azure, and WCF services. Visual Studio LightSwitch allows developers to seemless integrate this disparate data sources into a unified model which they can work with using the Visual Studio design surface.
The task of creating apps is further simplified with the inclusion of several inbuilt templates (complete with boilerplate code and design layout) for common app features such as screens for creating new records:

LightSwitch Templates
Apps built using LightSwitch can also integrate with Office 2010, the below screenshot shows data exported to Excel:

LightSwitch exporting data to Excel
LightSwitch apps will all be Silverlight based apps which can use with C# or VB or their core programming language. Deployment is simplified and applications can be deployed to the client, browser, or even Azure.
Details are still a bit thin on LightSwitch but I will update this overview once the beta is released on August 23 (to MSDN Subscribers only at first). A final version is planned for release early next year.
See Visual Studio LightSwitch Tutorial for more LightSwitch tutorials
]]>T4 is not tightly integrated into Visual Studio and there iss no item templates in File > New Item and no intellisense or syntax highlighting. To use T4 templates create a file with the extension .tt, add some text content, save the file, and then Visual Studio generates a code file from your template.
You can use complex logic by utilizing the T4 templating language to modify the output generated depending on various conditions. T4 templates in Visual Studio 2010 are compiled saved, thus they are essentially an additional type that can be instantiated in code. Scott Hanselman wrote a very good roundup of this in his article at www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx
To enable Intellisense for T4 templates you will need to download and install the Tangible T4 plugin at
http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23.
The definitive online guide for T4 information is at http://www.olegsych.com/2007/12/text-template-transformation-toolkit/
]]>