Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm in the testing phase of a ASP.NET app I've been throwing together over the last week, and I'm having trouble restoring the SQL database, because it keeps saying the database is in use.

 

Theres definetly nothing open referencing it... except for maybe my browser here... and that got me thinking... is calling the close method enough to disconnect from the database? Or should I call dispose too... I understood that I didn't need to call the dispose unless I really needed too... but maybe this will solve my problem???

 

thanks

 

Sam

Posted

I don't think there is your application problem. To restore SQL database, normally this message will display (database in use), because someone or we may just use it, so I will restart the SQL service.

 

For your information, if you use dataReader in your application, after finished your job, you need to close it (dataReader.Close) and set it to nothing (dataReader = Nothing) because dataReader will always keep the database connection. And it will cause the error if you try to open database connection again.

Posted

I was already closing my datareaders and connections when I was finished with them, but I was basically just checking that there was nothing else that I was missing in ASP.NET.

 

I think I like the idea or starting and restarting the server again, except that there are another 4 or 5 developers using the server (but other dadtabases) for their own testing...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...