Solved

Connection String to remote Server not working

Posted on 2016-10-09
3
92 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 33

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 33

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Obtain data from database .mdb 4 19
abstract class C# 1 31
Unlocking a column in excel using C# 17 21
Send form to asp server side 6 10
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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