SELECT MIN(SALARY) FROM EMP WHERE
SALARY IN (SELECT DISTINCT TOP N SALARY FROM EMP ORDER BY SALARY DESC)
Friday, October 17, 2008
Find n th highest salary
Monday, October 13, 2008
Export file to client
Following function downloads specified file from server to client.
=============================================
public static void DownloadFiles(string FileName)
{
HttpContext context = HttpContext.Current;
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);
context.Response.ContentType = "application/xml";
string Path = context.Server.MapPath(FileName);
try
{
context.Response.WriteFile(Path);
}
catch (Exception ex) { }
context.Response.Flush();
context.Response.End();
}
=============================================
public static void DownloadFiles(string FileName)
{
HttpContext context = HttpContext.Current;
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);
context.Response.ContentType = "application/xml";
string Path = context.Server.MapPath(FileName);
try
{
context.Response.WriteFile(Path);
}
catch (Exception ex) { }
context.Response.Flush();
context.Response.End();
}
Friday, October 3, 2008
Amount validation using Regex and Java Script
I come through a way to validate amount field.
This script validates amount field.
- If the value have a dot, It must be preceded and followed by one or two numerals.
var val = /^-?\d+(\.\d+)?$/.test(document.frm.txt_amount.value);
if(!val)
{
alert("Please enter correct amount.");
return false;
}
This script validates amount field.
- If the value have a dot, It must be preceded and followed by one or two numerals.
var val = /^-?\d+(\.\d+)?$/.test(document.frm.txt_amount.value);
if(!val)
{
alert("Please enter correct amount.");
return false;
}
Subscribe to:
Posts (Atom)