NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 41 42 43 44 45 … 93 Next »
What's the correct (sanctioned by sub) way to open the DB?

 
  • 0 Vote(s) - 0 Average
What's the correct (sanctioned by sub) way to open the DB?
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#1
2007-07-22, 10:51 AM
I tried using DatabaseHelperFactory to get the connection string, and then create an OleDbConnection, but it fails because the string has no "Provider=" in it. I don't know what the Provider string should be.

I tried using DatabaseHelperFactory.getDbProviderFactory().CreateConnection() but the connection fails when I call Open() on it, with

SystemException: Data Source cannot be empty. Use :memory: to open an in-memory database

So how exactly do I open the database? I know there are various example code fragments in the forum that refer to SQLite classes directly but that seems a bit hacky -- what's the *right* way to do it?

cheers

Dronny
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#2
2007-07-22, 04:32 PM
I prefer people dont access the database directly, but you should be able to do:


Code:
connection = DatabaseHelperFactory.getDbProviderFactory().CreateConnection();
connection.ConnectionString = DatabaseHelperFactory.getDbProviderFactory().getDbConnectionString();
connection.Open();

The golden rule though is 'dont create any tables, or modify the structure of any existing table in the database'.
DronnyBoyd
Offline

Member

Posts: 63
Threads: 15
Joined: Dec 2005
#3
2007-07-22, 05:32 PM
sub Wrote:I prefer people dont access the database directly, but you should be able to do:


Code:
connection = DatabaseHelperFactory.getDbProviderFactory().CreateConnection();
connection.ConnectionString = DatabaseHelperFactory.getDbProviderFactory().getDbConnectionString();
connection.Open();

The golden rule though is 'dont create any tables, or modify the structure of any existing table in the database'.

Hah! Sorry for being so dumb, of course I didn't realise I had to add the connection string to the connection object, databases really aren't my thing.

Don't worry I won't add any tables to the DB, if I need one I'll create my own database (which I understand is quite simple using SQLite) and do it that way.

Thanks for the prompt response! (what time was it in NZ??)

Dronny
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,789
Threads: 769
Joined: Nov 2003
#4
2007-07-22, 05:35 PM
DronnyBoyd Wrote:what time was it in NZ??
I'd rather not say :o (far too early)
« Next Oldest | Next Newest »

Users browsing this thread: 2 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Skin help (correct location?) SFX Group 4 3,949 2018-01-24, 07:42 AM
Last Post: pBS
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,993 2014-11-14, 02:05 AM
Last Post: Benoire
  Open Source Mheg+ Graham 0 1,483 2012-11-30, 06:32 PM
Last Post: Graham
  GBPVRLibrary - Open Source Components reven 76 25,329 2009-12-29, 09:26 PM
Last Post: whurlston
  Not looking in correct location for skin file scb147 4 2,310 2009-07-29, 06:26 PM
Last Post: scb147
  CommunitySkin 4 Open development thread. Fatman_do 110 26,195 2008-12-14, 09:04 PM
Last Post: McBainUK
  Community Skin 3.0 Open development thread. Fatman_do 99 23,198 2007-07-30, 08:32 AM
Last Post: McBainUK
  What's a good Open Source VB.net plugin that I could browse? zehd 0 1,204 2007-01-30, 02:00 AM
Last Post: zehd
  Question:How to open a window at (0,0) erik 2 1,347 2005-10-15, 04:36 PM
Last Post: erik
  Error: input string was not in a correct format sisuomin 6 3,274 2004-05-11, 08:56 PM
Last Post: Dai

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

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

Linear Mode
Threaded Mode