Tuesday, December 06, 2005

To strip off the time portion from a datetime datatype in SQLServer

In SQL Server, as the name suggests, the datetime datatype included the time info .If u just want to extract the date from the datetime column ,you should use

CONVERT(VARCHAR,CREATEDATE,105)
(replace createdate with your datetime column name)

Friday, December 02, 2005

Code for implementing “Download” option in your application

PrintWriter pw = response.getWriter();
String lsFullFileName = lsTabFile;// the path of the file on the server
FileInputStream in = new FileInputStream(lsFullFileName);
response.setContentType("application/csv");
response.setHeader("Content-Disposition","attachment;filename=<> ")
//the filename u want to show on the download window.
int i;
while ((i=in.read()) != -1)
{
pw.write(i);
}
in.close();
pw.close();