Skip to main content

Posts

What is GAC?

GAC is nothing but the folder where we have installed the shared assemblies. Still framework 2.0 it was installed in the folder C:\Windows\assembly\ The location of the GAC is changed by the framework 4.0. When installing the assemblies created by 4.0 Environment, it will install in the following folder: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\MySharedAssemebly\v4.0_10.0.0.0__b03f5f7f11d50a3a\ C:\Windows\Microsoft.NET\assembly\GAC_32\CustomMarshalers\v4.0_4.0.0.0__b03f5f7f11d50a3a The assemblies created by us will be installed under the GAC_MSIL folder. GAC_MSIL contains assemblies thet are run 32 bit or 64 bit machines. GAC_32 is only for 32 bit machine assemblies. Here, MySharedAssemebly is the shared assembly name.

SQL Server: How do get only Date from Datetime?

Hi, In real time business applications, we'll meet some scenarios like this. From our UI we'll send the Date time to the SQL Server to calculate the exact number of days different between today and the date passing by us. Actually the GETDATE() function of SQL Server gives the Server's Date time in this format: 2011-01-26 11:43:13.397 The Date time sending from client UI will be like this: 2011-01-02 12:00:00.000 When we try to calculate the exact number of days different between these it'll take time too. This may be give wrong answer. In this situation we can ommit the time part of the both dates. Here I wrote one SQL Server User Defined Function to achieve this.  CREATE FUNCTION [dbo].[UFN_GetExactDate] (@InputDate DATETIME ) RETURNS DATETIME BEGIN DECLARE @OutputDate DATETIME SELECT @OutputDate= CAST ( CONVERT ( VARCHAR (25),@InputDate,101) AS DATETIME ) RETURN @OutputDate END We can use this UDF in our Stored procedures like this: SELECT [dbo].[UFN_GetExactDate...

ASP.NET Dynamic Compilation

In ASP.NET Web Applications, When we request a page it must parse and compile the code of Web Application into one or more assemblies. When the code is compiled, it's translated into a language independent and CPU independent code, that's MSIL code. When we create an ASP.NET page, actually creating the source code for a .NET class. We are creating a new instance of the System.Web.UI.Page class.The entire contents of an ASP.NET page, including all script and HTML content, are compiled into a .NET class. When request an ASP.NET page, ASP.NET Framework checks for a .NET class that corresponds to that page. If a corresponding class does not exist, the Framework automatically compiles the page into a new class and stores the compiled class (the assembly) in the Temporary ASP.NET Files folder. The Temporary ASP.NET files folder located at : \WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files The next time anyone requests the same page in the future, the page is not co...

Difference between VB and C#

Each one language has it's  excellency and assets. VB: VB.Net supporting Event Driven Language. VB.Net has WITH Construct, Which is not in C#. Vb.Net support for Optional Parameters. C#: C Sharp supporting Object Orientation. C Sharp is fully typed language than VB.Net. XML Documentation is generated from source code C Sharp supporting  Operator Overloading. C Sharp supporting this operator. C Sharp supporting Pointer via Unsafe Block. In Dot Net We can share the libraries of languages collaborately in our programming. Dot Net supporting CLR, which helping to use the libraries of all the languages supported by .Net. .Net supporting more than 50 languages. .Net is an Language Independent Development Environment. So that it helping to the developers, coders very effiently. Even the J# developers can use the .Net environment for their development purposes.

Difference between DataSet and DataReader

Data Reader i) Data Reader is readonly so we can't do any transaction on them. ii) Data Reader will be the best choice where we need to show the data to the user which requires no transaction. iii) Data Reader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). As DataReader is forward only so we can't fetch data randomly. iv) .NET Data Providers optimizes the datareader to handle huge amount of data. DataSet i) DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas. ii) DataSet is always a bulky object that requires a lot of memory space compare to DataReader. iii) DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database. iv) DataSet can have relationship between the fetched tables. If you feel this tips help you th...

Select N th Maximum - SQL Server 2005

To Select Nth Maximum Value using TOP key word, You can try the following Stored Procedure. CREATE PROCEDURE SP_SelectTopN (@N INT ) /****************************************/ /* Created By : Loganathan V */ /* Created On: 21-Sep-2010, Tuesday */ /* Purpose : To Get the N th Top Value from*/ /*                Recordset. */ /* How to : EXEC SP_SelectTopN */ /*             : EXEC SP_SelectTopN 4 */ /****************************************/ AS BEGIN         DECLARE @P INT         SELECT @P=@N         SELECT TOP 1 * FROM         ( SELECT TOP (@P) * FROM SALARYTABLE ORDER BY SALARY DESC )   AS  TOPNRECORDS ORDER BY SALARY ASC END To Run the Stored Procedure follow this: ...

Multiplication Table in SQL Server

Multiplication Table in SQL Server This query gives the multiplication table from 1 to 10. DECLARE @A INT,                   @B INT,                   @C INT,                   @D VARCHAR (100)                   SELECT @A=1                  PRINT ' MULTIPLICATION TABLE 1-10' /****************************************/ /* Created By : Loganathan V */ /* Created On: 20-Sep-2010, Monday */ /* Purpose : Multiplication Table */ /* How to : RUN THE QUERY */ /****************************************/ WHILE (@A<=10) BEGIN         ...