Solved

Connection String to remote Server not working

Posted on 2016-10-09
3
85 Views
Last Modified: 2016-10-13
I have a c# application that needs to modify a value in a .CSV file.  Whilst developing the application I have used a local copy of the .CSV file and was able to read the contents of the .CSV file via the following connection string:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyLib; Extended Properties='text,HDR=yes;FMT=Delimited;ReadOnlt-false'

I now need to change this connection so that it reads the .csv file (of the same name)  from the remote server (Not a SQL server). I change the locally working connection string to:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\remoteServerName\7.7\samples; Extended Properties='text, HDR=yes; FMT= Delimited;ReadOnly=false' ;User ID=MyUserId; Password=MyPassword;  

However I receive the following error message: "Cannot Start your application. The workgroup information file  is missing or opened exclusively by another user."


Using the supplied remote server name , user Id and password I can manually remote on to the server and edit the .csv document. So what is wrong with the connection string that I cannot connect via my application?

regards
Pat
0
Comment
Question by:pclarke7
  • 2
3 Comments
 
LVL 32

Expert Comment

by:Big Monty
ID: 41836228
try the format found here by getting rid of the user ID property and changing the password parameter to "database password"

you may also want to try the JET provider, it works better with office apps

https://www.connectionstrings.com/excel/
0
 

Author Comment

by:pclarke7
ID: 41836806
Hi,
in the example given the password was on the excel spreadsheet. However in my situation the userid & password is of the server that the document is residing on. So they are too completely different situatons. The document That I am attempting to read is not password protected. However It does not exist locally. It resides on a file server.

regards
Pat
0
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
ID: 41836815
any userID and password you specify in the connection string are for the data source, not the server it resides on. Try it without specifying a userID or password. If that still doesn't work, then it's most likely a permissions error, meaning your account that's running your website (specified in IIS) does not have access to the location where the spreadsheet resides. you can verify this by copying the xls file to a location within your web site folder structure and see if you can connect.

you could also try creating a virtual directory that maps to your network location of the file: https://support.microsoft.com/en-us/kb/308150
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now