none
WCF and MS Access database

    Question

  • I'm using a WCF Service to access a database, like you would with a SQL database, but I'm using an Access database. The problem I have is that I keep getting this error: "The selected object(s) use an unsupported data provider."

    I'm wanting to be able to access my data through a web service, but I don't want to put my data on a SQL server.

    So my question is, Is there a way to access a MS Access database through a web service?

     

    Friday, May 22, 2009 1:21 PM

Answers

All replies

  • I'm not too sure how NHibernate works.

    I want to be able to call a web service that is accessing a database, can NHibernate do that?

    Friday, May 22, 2009 2:57 PM
  • I'm using a WCF Service to access a database, like you would with a SQL database, but I'm using an Access database. The problem I have is that I keep getting this error: "The selected object(s) use an unsupported data provider."

    How did you generate this error?

    I'm wanting to be able to access my data through a web service, but I don't want to put my data on a SQL server.

    You could use SQL Express edition and store the database file in your app_data folder.

    So my question is, Is there a way to access a MS Access database through a web service?

    You wouldn't access the MS Access database directly through the web service.  The web service would expose methods through which you can push and pull data.  In your web service layer, or in another layer (db layer perhaps), you would access the data store (MS Access, SQL Server, XML file etc.).

    NHibernate contains a Jet Driver that will assist you in writing .net code to use an Access database.

    Friday, May 22, 2009 4:10 PM
  • First, I created a LINQ to SQL Class, added a connection to my Access database,  and then tried to add a table from it to the designer. That's how I got the error.

    Second, my clients would like to be able to get data from an Access database. I understand that a SQL database would be easier to get data from.

     So, with the Jet Driver, I'll be able to access and edit information in my database?

    It would also help if NHibernate would work with the Silverlight runtime. Any other suggestions?

    Friday, May 22, 2009 5:16 PM
  • That would do it.  LINQ to SQL class only works with SQL relational objects.

    The System.Data.OleDb namespace is a collection of classes containing what you need to work with your Access database.  http://msdn.microsoft.com/en-us/library/system.data.oledb.aspx

    Here’s a number of .NET examples working with Access http://www.sourcecodeonline.com/list?q=vb_net_ms_access

    NHibernate is an object-relational mapping framework you can use if you like to map your Access objects to business objects.  Ken provided a link to an example using NHibernate.

    With or without NHibernate your WCF Service is going to define contracts.  OperationContracts on your web methods and DataContracts to customize any data transferred between your Silverlight client and your web service.  http://msdn.microsoft.com/en-us/library/ms729746.aspx

    Here's a link to creating a service for Silverlight clients: http://msdn.microsoft.com/en-us/library/cc197940(VS.95).aspx

     

     

     

    Saturday, May 23, 2009 4:10 PM
  • > Second, my clients would like to be able to get data from an Access database. I understand that a SQL database would be easier to get data from.

    To me the suggestion to use Sql Express is pretty good. To get your customer use MS Access you can create a connection from this client to Sql Server.

    hth

    Monday, May 25, 2009 5:44 AM
  •  

    Tuesday, May 26, 2009 11:54 AM
  • Thanks for the help on this ken, clint1222, and codeblock.

    I decided to just move to a SQL database, rather than a MS Access database.

    Tuesday, May 26, 2009 11:55 AM
  • good choice... you will be an happy man :)

    bye

    Tuesday, May 26, 2009 6:20 PM