Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Communicate with SQL db and share in LAN

Status
Not open for further replies.

TipGiver

Programmer
Sep 1, 2005
1,863
0
0
Hello,
I have a windows application that runs fine. Now i decided to share the application though a lan with other personal computers. I have made the output folder shared and i can access it from an other computers in the network. The application runs but it crashes when it comes to communicate with the database. The message is:

"The file '\\pc_name\...\db.mdf' is on a network path that is not for database files. An attempt to attach an auto-named database for file '\\pc_name\...\db.mdf' failed. A database with the same name exists, or specified file cannot be opened, or it is located on a UNC share"

My current connection string is:
String.Format("Data Source=.\SQLEXPRESS;AttachDbFilename={0}\database\db.mdf;Integrated Security=True;User Instance=False", Application.StartupPath)

Does anyone have any suggestion on what to do?

Thanks for any suggestion
 

You are be using one of the SQLServer Express editions for your database. From the SQLServer Express documentation (and from the error text you posted):

"network share, HTTP paths, or Universal Naming Conventional (UNC) remote databases are not supported."

You are using a UNC path to access your database: '\\pc_name\...\db.mdf'.

I'm not sure, but I think the culprit is "AttachDbFilename={0}". Try putting an actual path in place of the {0}.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Hi
today, after finding an enabling the tcp/ip, named pipes, shared memory and via (all of them just to be sure haha) and changing the connection string, the error that i get is that i have no access (login failed) for pc-name\guest. It uses the guest account!

Can i grant full access to the guest account? Or is there any link to read on how to create a user+password for the database?

Thanks
 
do you have the Management Studio installed? If so, it's really easy to add a new user. If you don't, google using these keywords: sql express management studio. There are many entries, inclusing ones to download the management studio.

As far as using guest. Is the guest account enabled on the computer/server where your db resides? IF the guest account lacks a password, are you sending a blank password with your connection?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top