Sample Access Providers
http://msdn2.microsoft.com/en-us/asp.net/aa336558.aspx
The good thing, since it was designed as an Abstract Class (Factory or
Provider Model)...somebody had probably already done it for you.
Just google "MembershipProvider" and YOUR_RDBMS
Although I wouldn't consider Access/(Jet database) a RDBMS...since its
just a file sitting on a drive somewhere.
But there you go.
There is a README with the Access about what it cannot do. Make sure you
look at that.
...........
Let me give you one more piece of advice.
Use IDataReaders when talking to your Access/Jet database. Again...use
IDataReaders?
Or use Strong DataSets. The issue with Access and strong DataSets is that
you can't populate multiple tables in the database automatically.
While this is a little more work....I would either do one of the
following:
1. Use IDataReaders to populate custom objects (per my blog)
2a. If yo ONLY need single tabled datasets, use the LoadDataSet method.
2b. If you need N (multiple) tables in your DataSets..... Use
IDataReaders and populate strong datasets. You'll have to do this
manually...and is a little more work.
You'll also have to hit the mdb N number of (seperate times) to do
this....but that's the crapper with Access....
(PS Always .Close() your datareaders......with "using" or in a finally
block....or you'll screw yourself as well)
However, the price you pay now will save you in the non-access future.
Why?
If you ever decide to NOT use Access, its alot easier to retool your
project.
Take a STRONG look at my blog, and the "1.1 Custom Objects" thing.
Try to think of Access in terms of using simple sql queries to get at the
data. Dont rely on Access specific syntax. That's is what will shoot you
in the foot later.
............
how to manually populate a strong dataset with an IDataReader?
EmployeeDS ds = new EmployeeDS();
IDataReader sourceReader = null;
try
{
sourcReader = //something.ExecuteReader(); //""Select EmpID, LastName,
FirstName from Employee";
while ( sourceReader.Read() )
{
EmployeeDS.EmployeeRow row = ds.NewEmployeeRow();
row.EmployeeID = sourceReader.GetInt32(0);
row.LastName = sourceReader.GetString(1);
row.FirstName = sourceReader.GetString(2);
ds.Employee.AddNewEmployeeRow(row);
}
finally
{
if (null!=sourceReader)
{
sourceReader.Close();///ohhhh so VERY important
}
}
Console.WriteLine(ds.GetXml());
Again, thats a short sample..use LoadDataSet for 1 table in a strong
dataset.
Use the above method for N tables in a strong dataset.
It sounds stupid....BUT I've personally written a project that will
support both Access and Sql Server. ... and I like the method.
http://groups.google.com/groups/search?hl=en&q=EmployeeSqlServerData
http://groups.google.com/group/microsoft.public.sqlserver.programming/msg/c5a90751a2a122be
http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/msg/19c9b0924188effa
Read those for how I used the Factory design pattern to handle that.
Good luck.
PS
On on web server based mini project, I don't fear using Access. Don't get
me wrong either. I dont love it, and the day my provider supports sql
express, I'll abandon Access in a heartbeat.
If you do alot of reading, and you wisely "get it and get OUT as fast as
you can" which is a part of the IDataReader thinking...you can give it the
ole' college try in Access.
Obviously, you'll have to monitor if its good enough.
But plan now, and you'll be able to switch out in the future.