tags:

views:

383

answers:

7

I am the lone .NET developer in an non-IT organization. I've been asked to develo ae .NET application using Microsoft Access as the back-end (existing DB).

I don't know where to start.

Since I'm developing by myself, what should I keep in mind to avoid during development? What situations does only a lone developer face?

Please include Microsoft Access specific advice in your answer, since that is germane to the question.

+1  A: 

If you are already familiar with a .NET language and MS Access then my advice would be to start off by developing a very simple MS Access database and write a small .NET console application that connects to that database and performs some basic functions e.g. querying/inserting/deleting/updating. Then its just a case of builiding on top of this piece by peice, introducing GUIs/separate libs (dlls) etc on the way.

Unfortunately for you .NET Linq to SQL (ORM) does not support MS Access databases so you will have to develop your Business Objects from scratch (not always a bad thing!).

Here is a good starting point MS Application with C#.

James
+12  A: 

Where to start?

  1. Choose a development environment (I would suggest Visual Studio 2008 Express or Professional, depending on the budget and the need for features of the Professional version)
  2. Even for one single developer: choose a Version control system !!!! (Subversion has only little administrative overhead, fine for one developer)
  3. Choose a .NET Framework version (3.5 is fine unless your application has to run on Win2K; for Win2K use .NET 2.0)
  4. Choose a mature programming language (C# or VB.NET, what you or your boss likes best)
  5. Choose a GUI technology (for a single developer, I would suggest using WinForms, unless you are going to write a Web application or a command line utility)
  6. Choose a mature DB access technology (ADO.NET works for a lot of things, unless you have very high performance requirements that are better dealt with old ADO/OleDB or DAO)
  7. EDIT: use Google to find some entry examples according to the choosen technology, or buy yourself a book. For example, here is one for C# using OLE DB to access a MS Access DB. This Access site is a good starting point, too.
  8. EDIT2: make yourself familiar with "Microsoft Access" (the Office Application). Not because you are going to use it like a typical user, but you will probably need it for administrative purposes. And the VBA & SQL documentation included will be sometimes helpful, even if you code with C# or VB.NET
  9. EDIT3: for reporting purposes, choose a reporting technology. There are plenty of possibilites here, depending on your needs, your skills and/or budget, for example

    • Plain ASCII or CSV reports (coded by hand)
    • HTML or XML reports
    • using Excel as reporting engine
    • using a PDF library like Report.NET
    • using a third party tool like Crystal Reports

    You will find a lot of helpful links when you give "report generation .net" to Google, for example this one.

And finally: come back to SO and ask more concrete questions when you come to the point where you have them.

There might be other constraints, depending on what code is already existing in your organization. And I would avoid technologies like F#, WPF or Linq to Entities.

Doc Brown
+1 For Version Control...I started out as a single dev in this type of environment, and implementing source control was one of the best things I could have done. In addition to allowing for rollbacks and tracking changes, knowing how to use source control is critical if you plan to move past the "single dev" environment..
Gus
He already said he's a .Net developer, he doesn't need advice on how to start developing in .Net, he just wants advice on how to handle his data which, at the moment, is in MS Access.
Chris Latta
.NET is a broad spectrum of technologies. I tried to make some suggestions which .NET parts I would choose under the given constraints.
Doc Brown
WPF has a huge learning curve, but I'd hardly classify it as bleeding edge; It's been around since 2006.
Richard Szalay
@Richard: ok, I have removed the term "bleeding edge"
Doc Brown
If you don't have an existing database i'd recommend that you create a n information model. This work should involve you and people from the business end so when you discuss features, functions and so forth, you're using the same terminology. A way to reduce misunderstandings.
magnus
Uh, so far as I know, ADO.NET can't do Jet/ACE, no? If so, can someone please provide a pointer on that?
David-W-Fenton
Nice answer here, basically it is a small application focusing Report generation. What i want to know is, is it necessary to use any design pattern on this?
Dhana
@David W. Fenton: Surely ADO.NET can do Jet/ACE (see, for example, here http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection%28VS.71%29.aspx or here http://visualbasic.about.com/od/learnvbnetandadonet/l/aa050303b.htm). However, AFAIK you don't have any modifying cursors/recordsets in ADO.NET (but for a Report generation tool one probably won't need it).
Doc Brown
@LittleBoy: I have added another hint according to 'reporting' to my original answer. However, I am not sure what you expect when you say "design patterns", I suspect you don't have the classical 'Gang of Four patterns' in mind (http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29), since IMHO this seems not to be related to your original question.
Doc Brown
@Doc Brown: "Surely ADO.NET can do Jet/ACE" (then citations of articles about OLEDB). So far as I know, ADO.NET != OLEDB. Classic ADO is a wrapper around OLEDB, but I don't know what ADO.NET is an abstraction of (I'm an Access programmer -- I use Jet/ACE natively, with not data-access layer except it's native DAO). Indeed, the second cite says "Only one product - SQL Server - is natively supported by an ADO .NET managed provider." That seems to indicate that using Jet/ACE via ADO.NET is like using Jet/ACE via classic ADO or via DAO -- you're using COM instead of native .NET technologies.
David-W-Fenton
@LittleBoy: "it is a small application focusing Report generation". Uh, are you using Jet/ACE as a data store, or are you wanting to automate Access reports from .NET? The two are completely different operations, and your original question sounds entirely like a question about a Jet/ACE data store. But now you've thrown the reporting in the mix. Which is it? How can people answer your question helpfully if you can't formulate it clearly? Or do you mean that you're using .NET technologies for the reporting? If so, why is it relevant to a question about a Jet/ACE datastore?
David-W-Fenton
@David: My citations were on the *System.Data.OleDb* part of the System.Data assembly of the .NET framework. Surely this uses classic ADO or OleDb internally, but for a .NET programmer, it provides you with the ADO.NET programming interface, with all of its pros and cons. In a .NET program, you can use this, or you can use classic ADO (via COM). Classic ADO has a very different API as ADO.NET with its pros and cons, too (as I already said above).
Doc Brown
A: 

While there are ways to connect .Net applications to MS Access, one of the strengths of Access is its ability to move its data up to Sql Server and link to it in Access as if it was part of the local database. So your first step should be to put the tables on Sql Server and just have links to the tables in your Access database. Access will still behave exactly as it did before except now you have your data in a real database that you can use from .Net.

Chris Latta
That is something I would NOT do unless there is a real need for Sql Server. Server databases require much more administrative effort, not the best idea for a single developer.
Doc Brown
I disagree. For MS Access sized databases, there is hardly any administrative burden and the benefits far outweigh the disadvantages. If the data gets so big it is an administrative burden, then it shouldn't be in Access anyway. This assumes that Sql Server is available however.
Chris Latta
The OP was asking for using Access as backend. The first thing you tell him is how to use Sql Server instead as a backend, without knowing anything about his number of users, size or complexity of his data, need for security and other requirements. I suspect that kind of advice is at least a little bit questionable.
Doc Brown
Depending on the nature of the application, SQL Server isn't always the answer. MS access does a job when required. Its the equivalent of moving up to EF from L2S just because it offers more.
James
Jumping straight to SQL Server is skipping some options... if Access doesn't pan out then the OP can explore SQLite, SQL Compact, SQL Express before considering spending a dime on a full-blown SQL Server install.
STW
@Yoooder - SQL Express is actually Sql Server Express so it part of the Sql Server family I was recommending exporting the data to. My advice isn't about killing the Access database and moving the data elsewhere, its about continuing to have the data available through Access as this is where the business is currently using it but getting the data into a more managable system for future development. Legacy systems continue to be supported. Its what we do here - move data to Sql, rewrite the reports in Reporting Services, create new data entry forms, only then decommission Access. It works.
Chris Latta
@Chris Latta writes: "move data to Sql, rewrite the reports in Reporting Services, create new data entry forms, only then decommission Access." You still don't seem to get that an Access app is not involved, only a Jet/ACE data store.
David-W-Fenton
Fascinating analysis, David. So your position is that he has an existing database with no legacy systems associated with it? Amazing. Well, amazingly unlikely. My original answer has no bearing on whether the legacy system is Access or not, but in only one sentence in one comment I describe what we do if it is and this is what you pick up on as my entire message? Wow. Anyway, even though you might not like it, this is what we do and it is easy, effective and beneficial and whatever legacy systems continue to work. But it assumes the enterprise is using/ready to use a Sql Server.
Chris Latta
You answer with SQL Server in mind even though the OP has clearly stated that the back end has to be Jet/ACE. If you'd addressed this in your answer and explained why you think that's a bad idea, you'd get more slack. But you just plunged ahead with an answer this is not helpful. That's why you're getting the downvotes -- it's the context that makes the answer bad, not the content (which in the context of a different question could be appropriate).
David-W-Fenton
Not really, David. I answer with Access in mind - I say explicitly that a strength of Access is its ability to upsize the data into Sql Server without the legacy applications being aware of it; the legacy Jet/ACE database to continues to be used for the current systems. As far as Access is concerned, the data is still there. I'm not saying "kill Access, install Sql, done". This is all about continuing to support the legacy system but giving yourself more options with the data for future development. I'm not sure why people don't get it but just because they don't get it, doesn't make it wrong.
Chris Latta
In any case, its a better answer than the most upvoted answer where, to answer the question "I'm a .Net developer, how do i deal with an Access database?" the advice is "install an IDE, use a version control system, choose a language between C# and VB.Net, and install the .Net framework". Talk about missing the entire point of the question - he's already a .Net developer. At least I'm addressing the actual question with a strategy that works well for us. Maybe I should just mention version control in all my future answers regardless of context and watch the +1s roll in...
Chris Latta
Read the title of the question: "Using MS Access as a .NET Application Backend". It's not about using Access as a front end at all, and the OP says a Jet/ACE back end is the only option, so you're just completely off-base in going off on the SQL Server tangent. It doesn't get the questioner closer to a solution that fits the limitations of the question.
David-W-Fenton
As an Access developer, I know a lot about Jet/ACE, but I know nothing about .NET, while experienced .NET developers likely have the opposite problem. I think it's not a very good question -- the people most able to provide detailed information about Jet/ACE are the least likely to be have any significant .NET experience. More specifics are required for the OP to get better answers. But "use SQL Server as your back end" is orthogonal to the original question. At least the answers you criticize are addressing the content of the question, rather than something that's been explicitly excluded.
David-W-Fenton
+6  A: 

Your question is too vague to give more than just general advice. If you have already developed other .Net applications, then the approach to developing this new application should not really be any different.

Database considerations:

The only things to bear in mind when using MS Access as a back-end database are:

  1. Scalability - MS Access does not scale very well and is only suitable for a small number of users *EDIT: Numbers vary depending on the type of activity the users are performing - for a reporting solution, Microsoft themselves suggest that up to ~100 concurrent users is the maximum - this white paper provides more information *
  2. Security - MS Access does not offer the same sophisticated levels of security that you will find in other database products (SQL Server, Oracle, MySQL)
  3. SQL Syntax - there are some subtle differences in the way you write certain types of query for MS Access
  4. Other Limitations - MS Access does not support stored procedures, so all your data access code will have to use inline SQL Commands (command.Type = CommandType.Text)
    1. The maximum database size supported by Microsoft Access is 2GB - keep an eye on the growth of the database

Design considerations:

  1. Does the existing MS Access database already have some user forms and code modules in it? If so, you could use these as the basis for your application - MS Access uses Visual Basic for Applications (VBA) as it's programming language and there are no tools/utilities that I know of that will port VBA to VB.Net

  2. Do similar applications exist elsewhere that could help inform your design?

  3. Keep data access code out of your forms as much as possible - try to keep data access code in a separate class/DLL so that it is easier to maintain

  4. EDIT: as others have suggested, try to avoid having instances of ADO.Net connection and command objects scattered throughout the user interface - put all database connection code in one class/DLL so that it easier to fix/maintain/replace. I'd also suggest putting all your SQL query statements in a separate class or module for the same reason. *
  5. Follow any in-house guidelines that you, or others before you, have put in place.

  6. Keep maintainability in mind - someone after you may have to make changes. Use comments in code and give your objects (forms/variables/function names) sensible names

  7. Take regular backups of your code - put a copy on a network drive or USB drive every day

Jazza
"MS Access does not scale very well and is only suitable for a small number of users": can you qualify "small number of users" here?
David-W-Fenton
"MS Access does not support stored procedures": Access/Jet/ACE has no *procedural* code, but it has its saved QueryDefs, which for SELECT statements are like VIEWS, and for DML SQL like stored procedures (without any procedural code). So the statement that you have to do all your SQL inline in code is COMPLETELY FALSE.
David-W-Fenton
"Keep data access code out of your forms as much as possible": what do you mean by "data access code"? The form is the natural place for code specific to that particular form's function. Obviously, if you need the same code in more than one form, you generalize it and put it in a standalone module. All that said, seems to me you've misread the question (though it does say "Access" and not "Jet/ACE"), since the question is about using Jet/ACE as a data store, not as an application development environment. Many of your comments apply only to an Access app, and not at all to a Jet/ACE data store.
David-W-Fenton
Have edited answer to provide more details
Jazza
@David: when you asked for "small number of users", why did you not post this link http://stackoverflow.com/questions/763888/is-ms-access-jet-suitable-for-multiuser-access/766181#766181 to this already given answer of yours?
Doc Brown
Why not post a link to an answer of mine? Because I don't remember all my answers, nor do I find it easy to locate them with the SO search facilities even when I *do* remember them!
David-W-Fenton
In regard to 100 as a max for a reporting app, I know people who've engineered read/write Access apps for user populations greater than 100 with a Jet/ACE back end. It's not easy, but it's doable if you know what you're doing and the schema and business rules and type of app make it feasible.
David-W-Fenton
@Jazza: there's an asterisk at the end of your answer. Did you mean to provide a footnote explanation of something?
David-W-Fenton
@David: No, it was an attempt to italicise some text to distinguish an edit
Jazza
+4  A: 

One point of advice, encapsulate all Access-specific code within a single class. The class should at least be able to:

  • locate the Access .mdb file
  • create and open all OleDbConnection objects
    • It's critical that all Connections are guaranteed to close, so wrapping their use in a using block is a very good idea
  • (Possibly) build and execute all OleDbCommands (removing the db-specific logic from the consuming components--they should be able to make data-requests and retrieve results while transparently creating the Connection & Command, etc.
STW
A: 

For accessing the Access database, you could maybe have a look at NHibernate? As far as I know it supports Microsoft Access and using a library like that could perhaps make things easier if you are going to move the data to some other kind of database later on.

Svish
Hibernate would not be my first choice if the task is using an existing DB, as the OP requires. It may work, but is it really worth the effort?
Doc Brown
Well, I don't have much experience with NHibernate, but it looks like a good database abstraction tool/ORM. And if you can use Linq for your queries(which I have read that should be possible), I would say it is definitely a good thing. My personal preference though, I think would be to use Linq to Entities, which from the latest PDC seems to be quite smooth in use. (http://microsoftpdc.com/Sessions/FT10)
Svish
I meant "is it really worth the effort when you have an already existing DB that was not specially designed for NHibernate"? By the way, the OP added a comment that he just wants to write a Report generation tool.
Doc Brown
I thought kind of the clue with NHibernate and other ORM tools like Entity Framework was exactly that you *don't* have to have a database that is specially designed for it. Anyways, it was just a suggestion :) I am currently working on a project where we are using Linq to SQL, and the database wasn't really designed with that in mind. Still, I don't think I would want to drop Linq to SQL even if you paid me for it. For reporting we use Microsoft Reporting Services.
Svish
@Svish: found an answer here that supports you, maybe of interest: http://stackoverflow.com/questions/454249/would-you-use-nhibernate-for-a-project-with-a-legacy-database-which-is-partly-ou
Doc Brown
A: 

There is a lot of good advice here, all I would add is be sure to build all your data access and modifying classes behind a well defined interface(s). I am sure there will come a time when this application out grows MS Access and having well defined interfaces will make upgrading to another database easier.

dionysus55