aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



{#advanced_dlg.about_title}
by Aamir Hasan   on Saturday, September 11, 2010
Set of groups by varying columns is called Grouping Sets. Grouping sets are equivalent to a Union All of quires.Microsoft introduce Grouping Sets in MS SQL 2008, it is introduce for developer to work easily.you can also use Union All if you not have MS SQL 2008 or later versions.   Syntax Group by Grouping sets (col1,col2,col3,.....,coln) Let's Start. Open your MS SQL server 2008. Create a new database or select existing database where you want to work. In this Example, i am using existing database.I have created temporary virtual tables with declare statement. A temporary virtual table is a table which look like a table but not store information in a database. Virtual table are read only.Virtual table are destroy automatically when the query execution is stop. Virtual table can not use syntax Drop. Create new temporary virtual tables  named Patient and PatientVisits  as shown in Figure 1.1 Figure 1.1 DECLARE @PATIENT TABLE ( ID BIGINT , FULLNAME NVARCHAR(MAX) , DOB DATE , GENDER CHAR(1) )DECLARE @PATIENTVISITS TABLE ( PATIENT_ID BIGINT , VISIT_DATE DATE , VISIT_TIME TIME , DOCTOR_FEE MONEY ) Let's store some records in Patient and PatientVisits temporary virtual tables as  shown in Figure 1.2 Figure 1.2   INSERT INTO @PATIENT ( ID, FULLNAME, DOB, GENDER ) VALUES ( 1, 'AAMIR HASAN', '08/13/1985', 'M' ), ( 2, 'AWAIS AHMED', '01/05/1965', 'M' ), ( 3, 'HASAN', '02/23/1980', 'M' ), ( 4, 'MAYRA GIBRAM', '08/13/1975', 'F' ), ( 5, 'SABA KHAN', '02/13/1995', 'F' ), ( 6, 'AAMIR HASAN', '01/01/1985', 'M' ), ( 7, 'MAHWISH HASAN', '04/17/1988', 'F' ), ( 8, 'SANA KHAN', '01/11/1981', 'F' ), ( 9, 'ZAHOOR AHMED', '08/13/1949', 'M' ) INSERT INTO @PATIENTVISITS ( PATIENT_ID, VISIT_DATE, VISIT_TIME, DOCTOR_FEE ) VALUES ( 1, '12/12/1981', '12:09:09', 500 ), ( 2, '01/12/1982', '12:09:09', 400 ), ( 3, '11/12/1982', '12:09:09', 300 ), ( 4, '11/12/1982', '12:09:09', 500 ), ( 2, '11/12/1982', '12:09:09', 800 ), ( 5, '11/11/2000', '12:09:09', 900 ), ( 6, '11/11/2003', '12:09:09', 500 ), ( 2, '11/11/2003', '12:09:09', 100 ), ( 3, '11/11/2003', '12:09:09', 500 ), ( 6, '11/12/2003', '12:09:09', 500 ), ( 7, '11/12/2003', '12:09:09', 500 ), ( 8, '11/12/2004', '12:09:09', 500 ), ( 1, '01/09/2005', '12:09:09', 500 ), ( 2, '05/09/2006', '12:09:09', 1500 ), ( 9, '05/09/2007', '12:09:09', 900 ), ( 1, '05/09/2008', '12:09:09', 100 ), ( 2, '05/09/2009', '12:09:09', 500 ), ( 4, '05/12/2009', '12:09:09', 400 ), ( 7, '05/12/2009', '12:09:09', 500 ), ( 8, '05/12/2009', '12:09:09', 200 ), ( 9, '09/12/2009', '12:09:09', 500 ), ( 2, '01/01/2010', '12:09:09', 5500 )     Following query will show the patient and patientVisits temporary virtual tables. SELECT * FROM @PATIENT SELECT * FROM @PATIENTVISITS Note: This should be done in one execution because above tables are virtual tables.   Following  query displays the Patient ID, patient Name, total sum of each patient of all visits. SELECT ID,fullname,SUM(DOCTOR_FEE) FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS((ID,fullname)) Output   Following query will returns All Patient ID, Patient Name, Doctor fee and grand total of All patients. SELECT ID,fullname,SUM(DOCTOR_FEE) FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS((ID,fullname),VISIT_DATE ) Output   Following query will returns year wise doctor fee. SELECT VISIT_DATE , SUM(DOCTOR_FEE) FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS(( VISIT_DATE )) Output Following query shows the year wise patient id,Patient name, year and total of doctor fee of all patients at the end of each year and grand total at the end of row. SELECT id , fullname , YEAR(visit_date) , SUM(DOCTOR_FEE) FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS(( id , fullname , YEAR(visit_date) ), id, ( )) Output Following query will returns each patient records yearly group wise and total of doctor fee of each patient at the end of year. SELECT id , fullname , YEAR(visit_date) AS [visit date] , SUM(DOCTOR_FEE) AS [Fee] FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS(( id , fullname , YEAR(visit_date) ), ( id ), ( YEAR(visit_date) ), ( )) Output Following query will return each month of year group of each patient records and total fee of doctor at each month and grand total of doctor fee at the end of row. SELECT id , fullname , MONTH(visit_date) AS [MONTH] , YEAR(visit_date) AS [Year] , SUM(DOCTOR_FEE) AS [Fee] FROM @PATIENT P , @PATIENTVISITS PV WHERE P.ID = PV.PATIENT_ID GROUP BY GROUPING SETS(( id , fullname , ROLLUP(YEAR(visit_date), MONTH(visit_date)) )) Output Conclusion Grouing sets is avaible in ms sql 2008, before going to start grouping set, you must have knowledge of grouping sets. Download Case 1 (1.92 kb) Case_2.sql (2.04 kb) Case_3.sql (2.07 kb) Case_4.sql (2.05 kb) Case_5.sql (2.19 kb) Case_6.sql (2.26 kb) Case_7.sql (2.29 kb)
Tags:
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, August 22, 2010
Session is a server side state management technique in ASP.NET. ASP.NET 4.O provide build in support for compress and decompress serialized Session state, By using this compress session state, you can improve your server performance. Compress option can be used when you are storing large amount of data in Session this will reduce the size of session. Session data can be stored in following two modes. In Process Store in the same ASP.NET Process Out of Process Store in Data base. To enable this feature, you have to set compressionEnable attribute to ture in Session State settings in Web.config. I have created a Web Site in Visual Studio 2010 as i will consider you know how to create a web site in Visual Studio 2010. Now i have stored some text in Sessions as shown in below Figure 1.1 Figure 1.1 Enable compressionEnabled= "true" in Session State of your Web.Config file as shown in below Figure 1.2 Figure 1.2 Now Load this Page and you will see the out put as i have shown in Figure 1.2 Figure 1.3 Disable compressionEnabled= "false" in Session State of your Web.Config file as shown in below Figure 1.4   Figure 1.4 Now Load your page, you will see the Begin Render and End Render time as shown in below Figure 1.5 Figure 1.5 This example shows that using ASP.NET 4.O new feature you can reduce the work load of your server but this will be effected when you are storing large amount of data. Download Compress Session State  in ASP.NET 4.O Password aamirhasan
{#advanced_dlg.about_title}
by Aamir Hasan   on Sunday, August 22, 2010
In this Article, i will tell you  about two new properties added to the page in ASP.NET 4.O that are MetaKeywords MetaDescription By using these two properties you can optimize your site for SEO. MetaKeywords List of keyword phrases that you are targets for specific page. MetaDescription Meta Description is used to display the content of your page in your earch engines. Note:Meta Description should not be more then 200 characters.   You can also set these two properties wthin the @Page directive at the top of .aspx pages as shown in below Figure 1.1 Figure 1.1 You can set these two properties programmatically within code-behind page classes as shown in Figure 1.2 . By using programmatically set keywords and description manually or reading them from database. Figure 1.2 I am using firebug to display the HTML output as you can see in Figure 1.3. At @Page level and on Page Load meta keywords and meta descriptions render and meta tag are display under the head section of HTML output page. Figure 1.3 Conclusion In ASP.NET 4.0 it is very easy to declare the keywords and description for the pages. By using MetaKeywords and MetaDescription makes your Web site SEO friendly Download Click here to download source code Password aamirhasan Demo Click here to see online Demo
Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5