NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 55 56 57 58 59 … 93 Next »
DatabaseHelperFactory.getDbProviderFactory() only works within GBPVR

 
  • 0 Vote(s) - 0 Average
DatabaseHelperFactory.getDbProviderFactory() only works within GBPVR
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#1
2006-05-18, 02:31 PM
Could this method be made to work even when GBPVR is not running. Or, if not, is there another way for me create the DbProviderFactory factory object myself?

Thanks

Jeff
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#2
2006-05-18, 03:59 PM
Hi,

sub has posted some code in the pre-release forum some days ago, which is doing what you want:

Code:
// find the appropriate DB provider factory
            try
            {
                string requiredDBProviderFactory = getValue("/settings/DatabaseProviderFactory", "System.Data.OleDb.OleDbFactory");
                if (requiredDBProviderFactory == "System.Data.SQLite.SQLiteFactory")
                {
                    Logger.Verbose("...using System.Data.SQLite.SQLiteFactory DB Provider Factory");
                    dbProviderFactory = new System.Data.SQLite.SQLiteFactory();
                }
                else
                {
                    System.Data.DataTable providers = DbProviderFactories.GetFactoryClasses();
                    foreach (DataRow row in DbProviderFactories.GetFactoryClasses().Rows)
                    {
                        try
                        {
                            DbProviderFactory tempProviderFactory = DbProviderFactories.GetFactory(row);
                            Logger.Verbose("Installed ADO.NET Provider: " + tempProviderFactory.GetType().FullName);
                            if (tempProviderFactory.GetType().FullName == requiredDBProviderFactory)
                            {
                                dbProviderFactory = tempProviderFactory;
                                Logger.Verbose("...using " + tempProviderFactory.GetType().FullName);
                                break;
                            }
                        }
                        catch (Exception ex2) { };
                    }
                }
                
                if (dbProviderFactory == null)
                {
                    Logger.Error("Unable to locate DB Provider Factory...about to crash");
                }
            }
            catch (Exception ex)
            {
                Logger.Verbose("Unexpected error locating DBProviderFactory: " + ex.ToString());
            }

-alibert
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#3
2006-05-18, 05:27 PM
Thanks!
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  TitanTv Remote Schedule For GBPVR UncleJohnsBand 51 34,193 2015-08-20, 05:11 PM
Last Post: sub
  Roku & GBPVR pvruser 16 11,588 2011-10-16, 08:31 PM
Last Post: pvruser
  (Yet Another) Rename Helper script for GBPVR & NPVR pvruser 2 2,768 2011-07-22, 01:27 AM
Last Post: pvruser
  Live GBPVR CD/DVD/Thumb drive :D pBS 101 29,525 2010-01-03, 06:22 AM
Last Post: pBS
  some help on basic gbpvr plugin code Etacovda 12 4,770 2009-06-14, 08:24 PM
Last Post: Etacovda
  Linking gbpvr.db3 to Access 2003: get readonly tables Khurram 5 3,977 2008-09-11, 08:35 AM
Last Post: Khurram
  UAC and Vista with GBPVR systemshark 2 1,964 2008-08-03, 07:20 AM
Last Post: systemshark
  Controlling an Audio Receiver with the GBPVR remote erik 7 2,773 2008-06-01, 08:31 PM
Last Post: erik
  SkipTool, do you use the GBPVR SQLite database? mkenyon2 1 1,627 2008-04-21, 07:30 PM
Last Post: pastro
  GBPVR.Public.EventTypes ACTCMS 4 2,110 2008-04-11, 01:02 AM
Last Post: ACTCMS

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode