Solved

Connection String to remote Server not working

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

17 Experts available now in Live!

Get 1:1 Help Now