my.net

My Photo
Name:
Location: United States

Friday, May 25, 2007

Retreive images thru ASHX (IHttpHandler)

<br />contents of NWEmpPhoto.ashx<br /><%@ webhandler language="C#" class="NWEmpPhotoHandler" %><br />using System;<br />using System.Web;<br />using System.Data;<br />using System.Data.SqlClient;<br />public class NWEmpPhotoHandler : IHttpHandler {<br />public bool IsReusable { get { return true; } }<br />public void ProcessRequest(HttpContext ctx) {<br /><br />ctx.Response.ContentType = "image/bmp";<br />ctx.Response.OutputStream.Write(pict, 78, pict.Length - 78);<br />}<br />}<br /><img src="NWEmpPhoto.ashx?id=1" /><br /><br />

Saturday, May 19, 2007

restore sql from bak file

RESTORE DATABASE MealManager FROM DISK='D:\data\SQL-Server\xx.bak' WITH MOVE 'Data_File' TO 'e:\xx_Data.mdf',MOVE 'Log_File' TO 'F:\xx_Log.ldf'

If you need a list of the logical and physical file names in the backup file:
RESTORE FILELISTONLY FROM DISK= 'D:\data\SQL-Server\xx.bak'

this should work.
RESTORE DATABASE MealManagerFROM DISK = 'D:\data\SQL-Server\xx.bak'

Friday, May 18, 2007

dllhost crash and hang

use IIS Diagnostics Toolkit to get user dump generated.