Ajiths blog

.Net /SQL for all

Entries for May, 2009

Post an HTML form to ASP.NET Page

For a web application we wanted to post html page to an ASP.NET page. So I thought of having a blog post about that.
                             First of all open visual studio and create ASP.NET project. After that you can do rest according to below steps.
1)      Create HTML page.
2)       Insert form tags and define form method(post) [...]

Comments (1)

Let’s get together all

Now we all know the latest news from Sri Lanka. The war is over.   
Let’s get together all Sinhala, Tamil and Muslim peoples as a one nation and build our country.

Leave a Comment

How to search or replace string from right side

Assume that you have comma separated names list and you want to replace last comma sign by string ‘and’, you can reverse string value and find the char index and do it as below(or download Script).   
DECLARE @StringList varchar(200)
DECLARE @index INT
DECLARE @lastWord varchar(100)
SET @StringList = ‘Aneef,Ajith,Gayan,Manoj,Jude,Julius’
SELECT @index=charindex(’,’, reverse(@StringList))
SELECT @lastWord=right(@StringList,charindex(’,’, reverse(@StringList)) -1)
SELECT SUBSTRING(@StringList,1,LEN(@StringList)-@index)+’ and ‘+@lastWord

Leave a Comment

SQL cumulative calculations without looping

               I have seen several times some people use loops, cursors to do cumulative calculations. But I think we can use following basic way to do calculations without using loops or cursors .Just create sample table (run attached script) and try following SQL
DECLARE @tempValue FLOAT
SET @tempValue=1
UPDATE Sample SET @tempValue=CalculatedValue=(MonthlyValue+1)*@tempValue
SELECT * FROM Sample
Download Script

Comments (1)

Happy Wesak to all Buddhist friends

Leave a Comment

  
Sri Lanka .NET 
                Forum Member