0

i wrote a software which would work perfectly fine on vb.net with connection string:

SQLConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename='" & a & "';Initial Catalog='" & f & "';Integrated Security=True;User Instance=True"

but if i try and run it on a pc with sql server 2005 installed it fails to run
what changes do i need to do to make it run

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by finito
0

thanks that worked but now arises another problem .After i have closed the application the database is still attached to the local server .i want to detach the mdf file from the server upon exit of the application.i used the DROP DATABASE command and that removes the database from the local server and the disk as well.i just want to remove it from the server.

0

I am not sure what you mean.

Just delete it from SQL Browser. why do you need to do it in the .net

I am assuming this is a One time thing. Just go into Sql Browser and delete it from there.

0

in the application the user can choose the mdf database he wishes to work with after he is done editing it .the application should detach the database and close.Its not a one time thing ,needs to be done via coding

i found a solution to it:
sys.sp_detach_db MyDatabase

but it tells me that cannot close as the database is in use

0

Make sure you have no connections open, and Dispose all SQLCommand, SqlDataReaders, SqlConnections, etc basically everything that called on the connection.

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.