Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 use .mdf file in workgroup windows 7

Author  Topic 

rana
Starting Member

5 Posts

Posted - 2011-10-22 : 05:02:30
Hi,Plz i need some help..
im using a vb.net 2008 & sql server express 2005 program, i just need to place the setup on 2 computers..on server pc i use the connection string (datasource=Server\SQLEXPRESS,AttachDbFilename=C:\Database\db.mdf;Integrated Security=True;User Instance=True)
this code works fine on the server cz it's local.
on the other computer i wrote : (datasource=\\Server\SQLEXPRESS,AttachDbFilename=C:\Database\db.mdf;Integrated Security=True;User Instance=True)

my problem is pc2 can't read the .mdf file..
[lz some help
thx

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-22 : 05:30:41
can both machines access each other?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rana
Starting Member

5 Posts

Posted - 2011-10-22 : 10:24:20
yes..i know things about network and sharing files and i do some test for this and put file file .mdb and work proply..
Go to Top of Page

rana
Starting Member

5 Posts

Posted - 2011-10-23 : 13:17:12
plz anyone can help in this topic
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2011-10-23 : 20:06:21
You should not use the AttachDBFilename option if you want multiple users to be able to access the same database. You should have SQL Server installed on the "server" system and the database mounted always.

Then, just connect without using the attach option to access that database from multiple systems.

You will have to open the ports in the firewall - and enable TCP/IP to allow this.

Jeff
Go to Top of Page

rana
Starting Member

5 Posts

Posted - 2011-10-24 : 02:34:34
do you mean
server:(datasource=Server\SQLEXPRESS,AttachDbFilename=C:\Database\db.mdf;Integrated Security=True;User Instance=True)

other computer
(datasource=\\Server\SQLEXPRESS,Database=C:\Database\db.mdf;Integrated Security=True;User Instance=True)
?

Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2011-10-24 : 14:33:05
Close, but - you need to mount that database in SQL Server and do not use the AttachDbFilename parameter to access it from any system - including the local system.

What the AttachDBFilename parameter does is attaches the database identified by the parameter - for that persons process to access and use. Once that persons process is done, the database is detached and no longer accessible.

Attach the database using SSMS, remove that parameter and just access the database. Leave it attached and online in SQL Server for all other users to access as needed.

Also, make sure you disable the following properties for the database:

Autoshrink
AutoClose

Both should be False.

Jeff
Go to Top of Page

rana
Starting Member

5 Posts

Posted - 2011-10-30 : 02:59:21
i found the solution,it seems to dowload the sql mananger express in the server pc and create an account as user....
Go to Top of Page
   

- Advertisement -