Click here to Skip to main content
16,004,854 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionsql to xml Pin
ritu432114-Jun-06 2:54
ritu432114-Jun-06 2:54 
AnswerRe: sql to xml Pin
sasidar_d14-Jun-06 3:54
sasidar_d14-Jun-06 3:54 
Questionbitmap class in vb.net [modified] Pin
amaneet14-Jun-06 2:41
amaneet14-Jun-06 2:41 
QuestionConnection Error, I can not solve Pin
Wael Inaim14-Jun-06 2:39
Wael Inaim14-Jun-06 2:39 
AnswerRe: Connection Error, I can not solve [modified] Pin
VenkataRamana.Gali14-Jun-06 3:23
VenkataRamana.Gali14-Jun-06 3:23 
GeneralRe: Connection Error, I can not solve Pin
Wael Inaim14-Jun-06 20:22
Wael Inaim14-Jun-06 20:22 
GeneralRe: Connection Error, I can not solve Pin
Wael Inaim14-Jun-06 21:53
Wael Inaim14-Jun-06 21:53 
QuestionWeb app not closing database connection? [modified] Pin
kbalias14-Jun-06 2:33
kbalias14-Jun-06 2:33 
Hi
I am having difficulty with a Web Application that does not seem to close or release a Sql Server database connection. I am using Visual Studio 2003 and SQL Server 2000.
I am using the following data access method:
public static void LoadData(string connectionString, string procedure)
{
	SqlDataReader reader = null;
	SqlConnection conn = null;

	try
	{
		//instantiate dbc
		conn = new SqlConnection(connectionString);
		conn.Open();

		//build command
		SqlCommand sqlCmd = new SqlCommand(procedure, conn);
		sqlCmd.CommandType = CommandType.StoredProcedure;

		//run command
		reader = sqlCmd.ExecuteReader();

		//here will use the data in the reader
		while (reader.Read())
		{
			//
		}
	}
	catch (Exception e)
	{
		throw e;
	}
	finally 
	{
		if (reader != null)
		{
			reader.Close();
		}
		if (conn != null)
		{
			conn.Close();
			conn.Dispose();
		}
	}
}

After I have run my Web App and closed it, I went to Query Analyzer and tried to drop the database (the database only has one table and I am just using it to test). It gives me the following message:
Cannot drop the database 'TestDatabase' because it is currently in use.

When I try the same data access method in a Windows App and try to drop the database afterwards it drops with no problem. So it seems to me that there must be something extra that I have to do to ensure that a Web App releases or closes the database connection.

Any ideas?

Thanks

Kobus

-- modified at 8:43 Wednesday 14th June, 2006
AnswerRe: Web app not closing database connection? Pin
mnaveed14-Jun-06 4:06
mnaveed14-Jun-06 4:06 
AnswerRe: Web app not closing database connection? Pin
Mircea Grelus14-Jun-06 8:52
Mircea Grelus14-Jun-06 8:52 
Question.net 2.0 framework Pin
fmardani14-Jun-06 1:21
fmardani14-Jun-06 1:21 
AnswerRe: .net 2.0 framework Pin
Paddy Boyd14-Jun-06 1:28
Paddy Boyd14-Jun-06 1:28 
AnswerRe: .net 2.0 framework Pin
mnaveed14-Jun-06 3:35
mnaveed14-Jun-06 3:35 
Questiondownloading a file Pin
murari_amar14-Jun-06 1:01
murari_amar14-Jun-06 1:01 
AnswerRe: downloading a file [modified] Pin
sasidar_d14-Jun-06 4:02
sasidar_d14-Jun-06 4:02 
QuestionMMS Pin
OmegaSupreme14-Jun-06 0:33
OmegaSupreme14-Jun-06 0:33 
QuestionTemplate Column in GridView 2.0 problem!!! Pin
amin_behzadi14-Jun-06 0:17
professionalamin_behzadi14-Jun-06 0:17 
AnswerRe: Template Column in GridView 2.0 problem!!! Pin
Paddy Boyd14-Jun-06 0:25
Paddy Boyd14-Jun-06 0:25 
AnswerRe: Template Column in GridView 2.0 problem!!! Pin
albCode14-Jun-06 0:34
albCode14-Jun-06 0:34 
AnswerRe: Template Column in GridView 2.0 problem!!! Pin
VenkataRamana.Gali14-Jun-06 0:42
VenkataRamana.Gali14-Jun-06 0:42 
QuestionThe AJAX "Top 5" security tips Pin
Moe Tarhini14-Jun-06 0:09
Moe Tarhini14-Jun-06 0:09 
QuestionSitemap Pin
Brendan Vogt14-Jun-06 0:08
Brendan Vogt14-Jun-06 0:08 
AnswerRe: Sitemap Pin
minhpc_bk14-Jun-06 20:25
minhpc_bk14-Jun-06 20:25 
Questioncode\logic to generate userid and password automatically [modified] Pin
subhsam13-Jun-06 23:56
subhsam13-Jun-06 23:56 
AnswerRe: code\logic to generate userid and password automatically Pin
Mircea Grelus14-Jun-06 8:59
Mircea Grelus14-Jun-06 8:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.