Wednesday, October 29, 2008

Select top and last five record from Database

In Query try this:

FOR TOP 5
select top 5 * from table

//-------------------

FOR LAST 5
select top 5 * from table order by primarykey_columnname desc

Good Luck

Validate URL

Try this with Regular Expression Validator

^((htf)tp(s?)\:\/\/~//)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

Good Luck

Validate Fileupload to accept JPG image

Use this with Regular Expression Validator

ValidationExpression="^(([a-zA-Z]:)(\\{2}\w+)\$?)(\\(\w[\w](.)*))+(\.jpg\.JPG)$"

or

ValidationExpression="^(([a-zA-Z]:)(\\{2}\w+)\$?)(\\(\w[\w].*))+(.jpg.JPG)$"

or

ValidationExpression="^.+\.(([jJ][pP][eE]?[gG])([gG][iI][fF]))$"

Good Luck