19 Dec: Must Read Codes [1-5]
Dec19

19 Dec: Must Read Codes [1-5]

Welcome to CodeSpread! We are sharing few must read codes/concepts which are required now and then. Each of these codereads doesn’t require a full length descriptive article so combining them into groups of five. CodeReads #1, Usage of ‘this’ keyword in C#. To qualify members hidden by similar name. To have an object pass itself as a parameter to other methods. To have an object return itself from a method. To...

Read More
SQL: Usage of char, varchar and varchar(MAX)
Nov24

SQL: Usage of char, varchar and varchar(MAX)

These are character data types in SQL. We will take an example and describe each type. Later we determine the cases where one of them can be applied. Create Table testable( Name char(20), Email varchar(250), Address varchar(Max)) CHAR We usually call it char or character. In the above example, Name is declared with char(20) as type. Here, 20 is the storage size and it does not depend on the actual length of name entered, whether is...

Read More
Questions related to Connection Pooling in .NET
Sep20

Questions related to Connection Pooling in .NET

What is Connection Pooling in .NET? Here, the term connection refers to connecting to a data source and Pooling means grouping together of resources. So, Connection + Pooling means grouping together of resources like connection. A more formal definition would be; a Connection Pool is a group of open and reusable connections. Why it is required? We know that, to execute any query against our database, we are required to establish a...

Read More
IDENTITY as SQL Property and IDENTITY as SQL Function
Aug29

IDENTITY as SQL Property and IDENTITY as SQL Function

IDENTITY as SQL Property: Almost all the time, We have a table with a primary key and would like to insert a new value automatically in the primary key field. To achieve this, We have IDENTITY property in SQL which creates an auto-increment field in the table. Syntax: IDENTITY [ (seed , increment) ] example: (1,1) An identity column has a name, initial seed and step.  Seed is the starting value for IDENTITY and Increment is the...

Read More
Verify existence of SQL tables using Object_ID()
Aug27

Verify existence of SQL tables using Object_ID()

Why Object_ID() ? Let’s create a SQL table “Employee” CREATE TABLE Employee ( [EmployeeID] [int] IDENTITY(1,1) PRIMARY KEY, [EmployeeName] [varchar](50) NULL, [Salary] [int] NULL, ) Looks ok!! But did I check whether the same table already exists in database? Good Question! Let’s check then, by verifying that the table has an object ID. IF OBJECT_ID(N‘Employee’) IS NOT NULL DROP TABLE Employee; CREATE TABLE Employee ( [EmployeeID]...

Read More
Page 1 of 512345