0

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");
}

Edited by happygeek: fixed formatting

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Jens
0

It would look to me like there is an error with connection to your database.
What is the type of exception you get?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.