Skip to main content

Posts

Showing posts from 2014

Fibonacci Series

Print Fibonacci Series:     Console.WriteLine("Print Fibonacci series");      int a = 0, b = 1, sum = 0, n = 10;             for (int i = 1; i <= n; i++)             {                 sum = a + b;                 a = b;                 b = sum;                 Console.WriteLine(a.ToString());             } Output:

Print ASCII Character

                 Console.WriteLine("ASCII Character");                     for (int c = 1; c <= 256; c++)             {                 Console.WriteLine(c + ": " + Convert.ToChar(c) + "\n");                 Console.ReadLine();             } Output:

Joining in SQL

This article explains how to join tables in SQL Server. Joining in SQL There are various type of SQL joinning. A few of them that are commonly used are described below. 1: Inner join 2: Right Outer Join 3: Left Outer join First Step First create a SQL table named bio. The following is the second table named fee.   Now  insert  values into the bio table. Now  insert  values into the fee table.   Second Step   using  System; using  System.Collections.Generic; using  System.Linq; using  System.Web; using  System.Web.UI; using  System.Web.UI.WebControls; using  System.Data.SqlClient; using  System.Data; public   partial   class   SQLJoins  : System.Web.UI. Page {      protected   void  Page_Load( object  sender,  EventArgs  e)     {     }      SqlConnection  con =  new   SqlConnection ( @"Data Source=IS9;Initial Catalog=practice;User ID=sa;Password=isource" );      protected   void  innerJoin_Click( object  sender,  Even

Check String is Palindrom

Definition    A   palindrome   is a word or sentence that reads the same forward as it does backward.   Source Code:     string str, rever = "";     int length;     Console.WriteLine("Enter String to check for Palindrom: ");     str = Console.ReadLine();     for (length = str.Length - 1; length >= 0; length--)     {         rever = rever + str[length];     }     Console.WriteLine(rever.ToString());     Console.ReadLine();     if (rever.ToString() == str.ToString())     {         Console.WriteLine("String is a Palindrom");         Console.ReadLine();     }     else     {         Console.WriteLine("String is not a Palindrom");         Console.ReadLine();     } Output:

Abstract Class

An Abstract class is a class that provides a common definition to the subclasses and this is the type of class whose object is not created. key points of Abstract classes are: Abstract classes are declared using the abstract keyword. We cannot create an object of an abstract class. If you want to use it then it must be inherited in a subclass. An Abstract class contains both abstract and non-abstract methods. The methods inside the abstract class can either have an implementation or no implementation. We can inherit two abstract classes; in this case the base class method implementation is optional.  An Abstract class has only one subclass. Methods inside the abstract class cannot be private. Abstract classes are useful when you need a class for the purpose of inheritance and polymorphism. The purpose of an abstract class is to provide default functionality to its subclasses When a class contains at l

LINQ

The three main data providers provided by Microsoft are: LINQ to objects for querying in-memory collections LINQ to SQL for querying relational databases LINQ to XML for querying XML data

What are the types of Authentication in ASP.NET?

 There are three types of authentication available in ASP.NET: Windows Authentication :  This authentication method uses built-in windows security features to authenticate user. Forms Authentication :  authenticate against a customized list of users or users in a database. Passport Authentication :  validates against Microsoft Passport service which is basically a centralized authentication service.

Login Form Using LINQ in Windows Forms Application

Step 1:  First we create a database and then Table in SQL Server. Here we create a table named “logintb”. Now insert a name and Password into the logintb table. Step 2:  Open Visual Studio then select "File" -> "New" -> "Project..." then select "Windows Forms". Drag and drop a Label for ID and a Label for password. Drag and drop a TextBox for txtuser and a TextBox for txtPassword. Drag and drop a Button for Login. Step 3:  Go to the project then right-click and seelct "Add" -> "New Item..." then select "Windows Form" -> "LINQ to SQL Classes" then click on "Add". Now go to the Server Explorer, drag and drop the logintb table as in the following: Open Server Explorer and select the database and then the table. Step 4 :  Now double-click on the button Login in the form and write the following code: CS Code:   using  System; using  System.Collections.Generic; using  System.Comp