Archive

Archive for the ‘Visual Studio 2005’ Category

This server version is not supported. Only servers up to Microsoft SQL Server 2005 are supported –Visual Studio 2005

May 25, 2009 shahharsh Leave a comment

To resolve the error , you can download the update- Microsoft Visual Studio 2005 Service Pack 1 Update for Microsoft SQL Server 2008 Support

This update enables developers to use Microsoft Visual Studio 2005 Service Pack 1 with Microsoft SQL Server 2008. For more information please visit the download link.

Download link:

http://www.microsoft.com/downloads/details.aspx?FamilyID=e1109aef-1aa2-408d-aa0f-9df094f993bf&displaylang=en

Happy Learning !!!

Introduction to Struct in C#

March 23, 2009 shahharsh Leave a comment

This article provides an introduction to Structs in C#. It gives a basic understanding on the following

    • What is struct?
    • When to use Struct?
    • Struct Examples
  1. Struct is a value type.
  2. It is used to encapsulate small related group of variables.
  3. It can also contain the following
    • Constructor
    • Fields
    • Constants
    • Methods
    • Properties
    • Indexers
    • Operators
    • Events
    • Nested types

Note: If you are planning to use all the above listed members then it is better to use a class. The reason is struct are mainly used for light weight objects.

4. Struct can implement interface but cannot inherit from another struct. Thus struct members cannot be declared as protected.

5. Except constants and static fields, we cannot initialize fields within the struct declaration.

6. We can declare constructors with parameters for structs.

7. All structs are inherited from System.ValueType (which inherits from System.Object).

8. Struct can be used as nullable type and can also be assigned a null value.

9. If you want to initialize the struct members then the only way is to declare a parameterized constructor and in that constructor initialize the struc members (Refer to the example 2 in this article)

How Structs are defined?

The Structs are defined by using struct keyword.

Example

Public struct TableDimension

{

//Declare Fields, constants,properties, methods ….here

}

Example 1: Creating a Struct

struct TableDimensions


            public int tableHeight;

public int tableLength;

}

Using struct:

private void btnStruct1_Click(object sender, EventArgs e)

{

          //Declare and Initialize the struct objects
          TableDimensions tbDim;

tbDim.tableHeight = 10;

tbDim.tableLength = 20;

        //Displaying value from the struct objects

         MessageBox.Show("Table Length " + tbDim.tableLength.ToString()); 

Note:

1. In the above example1 we can see that the struct object is created without using the new operator.

2. This means that there will be no constructor call for struct if we create an object without using the new operator.

3. In this case the struct fields will remain unassigned and cannot be used until they are assigned values. If you comment the fields assignment in the above example and try to compile the code then it will result in error.

Example 2: Creating a Parameterized constructor for struct and initialized the struct members 

//Declaring a struct

struct TableDimensions


public int tableHeight; 
public int tableLength;

public TableDimensions(int height1,int length1)

{
tableHeight = height1;

tableLength = length1;

}

}

private void btnStruct1_Click(object sender, EventArgs e)

{

TableDimensions tbDim1 = new TableDimensions(30, 60);

MessageBox.Show("Table Length " + tbDim1.tableLength.ToString()

);

}

Notes:

  1. In the above example we have created a struct with the parameterized constructor to initialize the structure fields

  2. When we create an object of a struct using new operator, the new operator doesn’t acts like a class but it simply calls the declared constructor and initialize all the fields.

  3. Parameterized constructors are the only way in structs to initialize the struct members.

Hope you liked the introduction to struct in C#…your suggestions are welcome.

Happy Learning…by Harsh Shah

Download Application Architecture Guidance for .Net

November 28, 2008 shahharsh Leave a comment

This guide provides guidance on Application Architecture for .Net Applications. For more information please download the guide from the below CodePlex Site.

Thanks to the CodePlex team, Patterns and Practices Team ,Industry Experts and all the professionals who contributed to the App Arch Guide.  

Download App Arch Guide: http://www.codeplex.com/AppArch

 

Happy Learning !!!

How to change default language in Visual Studio 2005

November 28, 2008 shahharsh 7 comments

 

Note: Please try this in your test environment only and also export your previous settings before you proceed.

  1. Click on Visual Studio 2005 menu and go to Tools –> Import and Export Settings

image

2.  Select Reset all settings and then click next.

image

3.  Once you click next you will get the below screen. Here you will provide path to save your current settings. It is advisable to save your current settings before you proceed. So that you can even import later if you want your previous settings back.

Click Next once you provide the appropriate path.

image 

4.  Now, you will get the below screen where you will select the default language you would like to have when you select New Project in Visual Studio 2005. Select your desired language and click Next.

image

5.  Once you click Next, it will process and set your desired language as a default settings. After completing the process you will get the below dialog box.

 

image

Note: Please try this in test environment only.

Happy Learning..!!!

By Harsh Shah

Categories: Visual Studio 2005

Visual Studio 2005 for SQL Server 2008

March 8, 2008 shahharsh 2 comments

This CTP enables developers to use Visual Studio 2005 for SQL Server 2008 CTP5.

Please note the following:

Please test in a test environment only

This CTP addresses the following issue:

“This server version is not supported. Only servers up to Microsoft SQL Server 2005 are supported.”
This CTP addresses this issue, and enables the following Visual Studio functionality for SQL Server 2008 CTP5 :

  • Server Explorer successfully connects to SQL Server 2008, and database objects such as stored procedures and table data can be viewed and edited. Note that table schemas still cannot be viewed or edited in this release.
  • SQL CLR projects that target SQL Server 2008 CTP5 can be created and deployed to the server.
  • T-SQL and SQL CLR debugging are now enabled for SQL Server 2008 CTP5.
  • Data binding features in Client and Web Projects are enabled.

This CTP does not support the following features for SQL Server 2008 Nov CTP:

  • Creating and editing table schemas in Table Designer or Database Diagrams. The table designer feature in SQL Server Management Studio 2008 can be used to edit table schemas in SQL Server 2008 CTP5.

For more information please visit the following link.

http://www.microsoft.com/downloads/details.aspx?FamilyID=e1109aef-1aa2-408d-aa0f-9df094f993bf&displaylang=en