Hi I have created an application which displays Images on another page as thumbnails.
It is giving me the following error;
An attempt to attach an auto-named database for file D:\Users\i-chaitanyau\My Documents\Visual Studio 2005\ThumbNailView\App_Data\aspnetdb.mdf
failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
The block of code that I have used is as follows:
public void ProcessRequest (HttpContext context)
{
SqlConnection mycon = new SqlConnection(conStr);
mycon.Open();
string sql = "Select Image from Images where ImageId=@ID";
SqlCommand cmd = new SqlCommand(sql,mycon);
cmd.Parameters.Add("@ID", SqlDbType.Int).Value = context.Request.QueryString["id"];
cmd.Prepare();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.ContentType = dr["Type"].ToString();
context.Response.Write("Hello World");
}