Wednesday, March 21, 2012

Distant access to Excel file for import

Hi,

I'm developping a web application and I need to import a data from an excel file to sql server 2005.

It works very well locally (visual studio & sql server & the excel file on the same machine).

But it doesn't work when visual studio & excel file are in a machine and sql server is in another server.

I have always the same problem:

'C:\Documents and Settings\momo\Bureau\File.xls' n'est pas un chemin d'accès valide. Assurez-vous que le nom du chemin d'accès est correct et qu'une connexion est établie avec le serveur sur lequel réside le fichier.

Could any one help me please ?!

Thank you in advance.

It would help if you translated the French error message to English.

|||

Sorry to be late !

Here is the translation :

'C:\Documents and Settings\momo\Desktop\File.xls' isn't a correct access path. Be sure that the name of the access path is correct and a connexion is established with the server where is the file.

In fact, I'm using the FileUpload control as follows:

string filemap = Convert.ToString(fileupload.PostedFile.FileName);

string conString = @."Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=""Excel 8.0;HDR=YES;"";Data Source=" + filemap;

Could you tell me, please, what do I have to modify in order to be able to import my file from any client machine (of course, each client machine has a copy of the same file locally).

Thanks in advance.

|||

You need to think of a different architecture. You should create a web service that writes to the SQL Server. On each client PC you need a windows application that can read the excel spreadsheet and write to the web service.

|||

Please, could I have more details on how to do it. I'm a begginer in ASP NET and so I do not know what a web service means exactely.

Thanks.

|||

Have a look at http://quickstarts.asp.net/QuickStartv20/webservices/default.aspx and work through the tutorial

"The ASP.NET Web Services QuickStart is a series of client and server samples along with supporting commentary designed to quickly acquaint developers with featuresin ASP.NET Web Services. The QuickStart samples are designed to be short, easy-to-understand illustrations of these features. By the time you finish reviewing these samples, you will be familiar with the majorfeature areas in ASP.NET Web Services. "

No comments:

Post a Comment