Running C# From Access

Learn2010

Registered User.
Local time
Today, 06:29
Joined
Sep 15, 2010
Messages
415
I currently have a 2003 Access database. It is linked to an external database (Oracle). The users (2 of them) are constantly using the program to assign and close out jobs. They start on a form (frmOptions) and open the assignment screens. When they return to frmOptions, a vba module is run that pulls data from the linked database. The assigning, closing, and running of the module takes about 30 to 90 seconds. If frmOptions is idle for three minutes, it runs that module itself.

I just started learning C#. I want to create a process in C# that will append data from another database to a file that I can link to with Access. C# is my only option at this time. Can I do this? If so, can you offer any suggestions that may help me?

Thank you.
 
You can do this, but the better question is why would you want to? Maybe I'm missing something but based on your description you have data already in another database and you want to write something in C# to move it to a third database which you can link to Access? Why not just link Access to the initial database and go from there?

I love C# and I write the majority of my applications in it these days with SQL Server as my back-end, but for my Access apps I generally stick to an Access front-end, some exceptions to this of course, like when I really need to do something that Access is not great at doing (FTP, invoking web services, etc...).
 
I'd second DJkarl's point - if it's already linked in Access, I have difficulty seeing how we have to do it in C# since it'd be faster & easier to use Access/VBA to automate the process.

In case there's more to the picture and you really, really need C# (e.g. asynchronous processing, working with web services, a mid-tier DLL... something like that), then there's a sample I posted years ago for consuming .NET components in an Access database. The project was originally done in C# but in answer to a request, I redid it in VB.NET but the concepts should be generally comparable.
 
I didn't do a good job of explaining it. I will have to use C# to get the data out of another program, not the one I am already connected to. This other program sends an order to the printer. I need to write something in C# to get the data from the temporary file that is created. As it stands, that is the only option. What I would like to have happen is for Access to activate the script that will run C# and have it append that file to a file that I will create and link to. I am very limited in my options. SQL may be an option in a couple of months, but not right now.

Thanks.
 
I'm assuming you need C# to parse the temp file data (this could be done from Access VBA as well, but for S&Gs lets say it can only be done from C#). What type of temporary file is this? Text, binary, hopefully not a spool file being sent to the printer. If it is as simple as wanting to create a copy of a temp file in a another location that you can "link to", look at the System.IO class, the objects in there should provide you the methods to open, copy and otherwise move or manipulate files.
 

Users who are viewing this thread

Back
Top Bottom