How to run Access macro from asp.net (C#) Application ?

  • Thread starter Ananth Ramasamy Meenachi
  • Start date
A

Ananth Ramasamy Meenachi

Hi All,
Do anyone have experiance running a Acccess macro from asp.net with
C#. I tried with windows application it worked fine but i lose my thread in
asp.net application.

Ananth Ramasamy Meenachi
Programmer Analyst
 
B

Brendan Reynolds

The only way to do this is by automating Access, and you probably don't want
to do that from an ASP.NET app - the automation will happen on the server,
so every concurrent user of your ASP.NET app will be launching a new
instance of Access on the server. To say that this is not a scalable
solution would be an understatement.

There's probably a better way. What does the macro do?
 
A

Ananth Ramasamy Meenachi

Hi Brendan Reynolds,

Actually I need to copy a set of rows and columns from xls to
access staging table and then to validate records and push them 1to master
table.

I created a macro, with Action "TransferSpreadsheet" , xls path specified
and also table specified. When i run this macro three columns from the said
XLS will be copied to Staging table in Access db.

And Another macro for validating rows in each column.

Admin has to run these macro's from germany through asp.net application
which is in USA. Xls will also be uploaded by admin to application server. Is
there any possiblity of using macro or any other method.

Ananth Ramasamy Meenachi
Programmer Analyst
 
B

Brendan Reynolds

The best way to transfer the data is to execute a SQL statement. The
simplest solution would be to create a link to the spreadsheet in the MDB.
Then you just need to execute a simple append query to copy the data from
the linked spreadsheet to the Access table. If for whatever reason you can't
link the spreadsheet, you can use an ADO.NET OleDbDataAdapter to read from
the spreadsheet and write to the database. Take a look at some of these MSDN
articles for examples ...

http://search.msdn.microsoft.com/search/default.aspx?siteId=0&tab=0&query=ado.net+excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top