To know the stored procedure created date and modified date in Sql Server
SELECT name, create_date, modify_date
FROM sys.objects
WHERE type = 'P'
AND name = 'sp_name' -- stored procedure name
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
14 September 2012
To show the stored procedure permission details in SQL Server
To show the stored procedure permission details in SQL Server:
select U. name, O. name, permission_name from sys . database_permissions
join sys . sysusers U on grantee_principal_id = uid
join sys . sysobjects O on major_id = id
where O. name like 'sp_name' -- stored procedure name
order by U. name
8 September 2012
Web application vs Webservice vs WCF in asp.net
Web application vs Webservice vs WCF in asp.net
Disadvantage of Web application
-------------------------------
In web application, its not possible to connect different technologies for eg[Java and Dotnet] and not possible to connect the application in two different servers.
Why Webservice?
-------------------
Webservice use SOAP (Simple Object Access protocol) and it is used to connect the web application using different type of technologies, and possible to connect the application that have hosted in different type of servers.
Disadvantage of Webservice
-----------------------------
Webservice use only HTTP Protocol.
It provides only singlex communication, not half duplex and full duplex communication.
They work in an stateless fasion over HTTP and are hosted inside a web server like IIS
Half duplex
-----------
Half-duplex data transmission means that data can be transmitted in both directions on a signal carrier, but not at the same time.
half-duplex transmission implies a bidirectional line (one that can carry data in both directions).
They work in an stateless fashion over HTTP and are hosted inside a web server like IIS
Full duplex
------------
Full-duplex data transmission means that data can be transmitted in both directions on a signal carrier at the same time.
Full-duplex transmission necessarily implies a bidirectional line (one that can move data in both directions).
Advantages of WCF Service
-----------------------------
WCF Service support HTTP, TCP, IPC, and even Message Queues for communication.
We can consume Web Services using server side scripts (ASP.NET), JavaScript Object Notations (JSON), and even REST (Representational State Transfer).
It can be configured to have singlex, request-response, or even full duplex communication.
These can be hosted in many ways inside IIS, inside a Windows service, or even self hosted.
Difference between Sleep and Hibernate in Laptops?
Difference between Sleep and Hibernate in Laptops?
-Sleep is a power-saving state that allows a computer to quickly resume full-power operation, Sleep puts your work and settings in memory and draws a small amount of power.
-Hibernation is also a power-saving state designed primarily for laptops. It puts your open documents
and programs on your hard disk and then turn off your computer.
Off all the power-saving states in Windows, hibernate uses the least amount of power.
If you won't use your laptop for an extended period and won't have an opportunity to charge the battery during that time - Hibernate is most efficient one.
21 August 2012
SQL SERVER – Query to Find Seed Values, Increment Values and Current Identity Column value of a table
SQL SERVER – Query to Find Seed Values, Increment
Values and Current Identity Column value of a table
SELECT IDENT_SEED(TABLE_NAME) AS Seed,
IDENT_INCR(TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE' and
TABLE_NAME='MSubject' -- [Table name]
For all the table in Database:
SELECT IDENT_SEED(TABLE_NAME) AS Seed,
IDENT_INCR(TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE'
7 August 2012
Lamda expression in C#
Lamda expression in C#
A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions use the lambda operator =>, which is read as "goes to".
The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x."
This expression can be assigned to a delegate type as follows:
To create an expression tree type:
A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions use the lambda operator =>, which is read as "goes to".
The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x."
This expression can be assigned to a delegate type as follows:
delegate int del(int i); static void Main(string[] args) { del myDelegate = x => x * x; int j = myDelegate(5); //j = 25 }
To create an expression tree type:
using System.Linq.Expressions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Expression myET = x = > gt; x * x;
}
}
}
The =>; operator has the same precedence as assignment (=) and is right-associative.Lambdas are used in method-based LINQ queries as arguments to standard query operator methods such as Where.
6 August 2012
Anonymous Types in C#
Anonymous Types in C#
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first.
The following example shows an anonymous type that is initialized with two properties named Amount and Message.
var v = new { Amount = 108, Message = "Hello" }; // Rest the mouse pointer over v.Amount and v.Message in the following // statement to verify that their inferred types are int and string. Console.WriteLine(v.Amount + v.Message);
In the following example, the names of the properties of the anonymous type are Color and Price.
var productQuery = from prod in products select new { prod.Color, prod.Price }; foreach (var v in productQuery) { Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price); }
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...