Tag: How to

How to ALTER a Column from Null to NOT Null in SQL Server ?

Assume a scenario where you have a table that contains columns which are Nullable integer column. You might want to update them to NOT NULL column (adding NOT NULL constraint) and set its value to zero. How to ALTER a Column from Null to NOT Null in SQL Server ? This would be a two step process where you should first update the column values…

CS1502: The best overloaded method match for System.Web.WebPages.WebPageExecutingBase.WriteSystem.Web.WebPages.HelperResult)’ has some invalid arguments Error in ASP.NET MVC

If you are getting the below error message in ASP.NET MVC Web Application, you can resolve it by looking at the methods that renders the partial view in the screen. “Server Error in ‘/’ Application. ——————————————————————————– Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code…

Inner Join in SQL Server

You can use inner join to get the result of two tables that match the criteria. For example , assume that you have a Person table and a Phone Number table where every person would have 0 or more phone number associated to him and you wish to get the person records who have at least one phone number. Here’s the query on how to…

How to check if a column exists in a table in SQL Server ?

If you want to find out if a column exists in a SQL Server table , you can use the sys.columns table and specify the name of the column and table as parameter. How to check if a column exists in a table in SQL Server ? For example , you want to find out if the GroupName column exists in the table “HumanResources.Department” table…

How to Set Startup Projects in Visual Studio 2012 ?

There are times when you want to set which project in your visual studio solution should be built and deployed first. You can set the startup projects in Visual Studio 2012 easily by following the below steps How to Set Startup Projects in Visual Studio 2012 ? 1. In the Visual Studio 2012 Solution explorer , select the startup project. 2. Right click and select…

Sleep Command in SQL Server

If you are looking at writing a query to sleep for or WAIT for a certain amount of time before the query execution can begin , you can use the WAITFOR command. For example , if you want to wait for 1 minute , the query or command for the same will be this.

VB.NET Program to display "Hello, World!"

Problem Write a program in VB.NET to display “Hello, World!” on the screen. VB.NET Program to display “Hello, World!” in Console Window. This is a simple VB.NET program that displays “Hello, World!” on the console window. Output Hello, World! In the above program , Main() is the starting point for the program and the Console.WriteLine function is used to display the string on the Console…

Get the Current Location from Windows 8.1 Store App using JavaScript

Below is a sample code snippet demonstrating the procedure on how to get the current user location Windows 8.1 Store App using JavaScript. How to Get the Current Location from Window 8.1 Store App using JavaScript ? Add the button and the span element to the html page where you want to show the current location. <button id=”GetLocation”> Get Location </button> <span id=”locationinformation”></span> Add the…

C Program to find if the input is a Armstrong Number or Not

Problem Write a program in C to find if a given number is Armstrong number or not. How to check if a number is a Armstrong number or not in C programming Language ? A given number is a Armstrong number of order n if abc… = an + bn + cn + … For example , 371 is a Armstrong number because the result…

How to Compute area of a circle in C# ?

Below is a sample sourcecode that demonstrates the computation of the area of a circle in c# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { double radiusofcircle; double areaOfCircle; double pi = 3.1416; radiusofcircle = 25; areaOfCircle = radiusofcircle * radiusofcircle * pi; Console.WriteLine(“Area is ” + areaOfCircle); Console.Read(); } } }

How to find if 2 Objects are Equal in C#?

There are times when you need to determine if 2 objects are equal or not. In these cases, you could either override the Equals method or implement IEquatable interface. How to find if 2 Objects are Equal in C#? Below is a sample code snippet demonstrating the usage of Object.Equals method to find the equality of 2 objects.