ali raza

C#, .Net ,Asp.net and my thoughts

Monthly Archives: July 2007

I love this poem what u think about that

dream

If you dont have dreams, you have nothing

how to upload larger files in asp.net 2

by default asp.net application did not upload file more than 4.5 mb or 4 mb. For this purpose You have to add following http runtime tag in web.cofig of web site.

<httpRuntime executionTimeout=90 maxRequestLength=20096useFullyQualifiedRedirectUrl=false minFreeThreads=8 minLocalRequestFreeThreads=4appRequestQueueLimit=10000;/>

you have to change two setting in above code.MaxRequestLength (Here you mention the size limit of file , bydefault it is 4 mb) and appRequestQueueLimit (it is the time when application take time to upload the request.)

A beatiful song from Sain Zahoor.

I hear a sweet song on youtube. I feel it in my soul when i hear it. all the night i continuosly hearing while learning php alone in my room at very hot day of july. This song is aslo theme song from movie Khuda Ke Liye (In the Name of God) .

database level paging in Tsql 2005 with common table expression

In MSSQL 2000 we used to do paging either by dynamic sql or by some
 advanced techniques like the example with rowcount.
In MSSQL 2005 with the introduction of ROW_NUMBER
 function life is a lot easier.   

 
DECLARE @PageNum AS INT;
DECLARE @PageSize AS INT;
SET @PageNum = 2;
SET @PageSize = 10;
 WITH OrdersRN AS (     SELECT ROW_NUMBER() OVER(ORDER BY OrderDate, OrderID) AS RowNum           ,
OrderID ,
OrderDate,
CustomerID,
EmployeeID
FROM dbo.Orders )
SELECT *    FROM OrdersRN  WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1 AND @PageNum * @PageSize  ORDER BY OrderDate,
OrderID;
 

Common Table Expression

There’s a good article here by Frank Kerrigan on a way to implement paging in SQL Server 2005 by using Common Table Expressions (CTE’s).

What are CTE’s?  This is a new feature of SQL Server 2005 that helps you eliminate temp tables and cursors in your queries.  You can generate some pretty amazing queries using recursive CTE’s, but that’s not what Frank is trying to demonstrate.  Anyway, they can be used similarly to a derived table.

Here’s the syntax:

[ WITH <common_table_expression> [ ,...n ] ]  <common_table_expression>::=         expression_name [ ( column_name [ ,...n ] ) ]     AS         ( CTE_query_definition ) 

how to remove Html tags from string in c#

use this function

public string Strip(string text)
{
    return Regex.Replace(text, @”<(.|\n)*?>”, string.Empty);
}