NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 25 26 27 28 29 … 93 Next »
Starting out with vb.net and sqlite3...

 
  • 0 Vote(s) - 0 Average
Starting out with vb.net and sqlite3...
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#1
2008-03-21, 05:58 PM
Well, I'm starting using VB .net. One of the things that I think I will like is that the code is translatable to C# and back. (I figure going from VB6 to C# would hurt too much)

I'm terrible at starting all over, tonnes of questions and a bit lazy ("man, I already know how to do that, why do I have to learn THAT again!!!!)

Anyway, I'd like to hook into the System.Data.SQLite.dll from the gbpvr folder. (Finally I can use the same stuff as you guys)

BUT

I checked out the creator's web site and can't seem to find docs for hooking into it.

By the way, is that actually called 'binding'.... (I'm so embarrassed. I'm such a hacker)
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#2
2008-03-21, 06:19 PM
Never mind
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#3
2008-03-21, 06:24 PM
I dont have a convenient ready to use bit of code to cut and paste for you, but here is some bits that might piece together for something useful:

Setup DBProviderFactory (useful if you intend to introduce support for different DB types in future)
Code:
DbProviderFactory dbProviderFactory = new System.Data.SQLite.SQLiteFactory();

Create a database connection:
Code:
DbConnection connection = dbProviderFactory.CreateConnection();
connection.ConnectionString = "Data Source=".\gbpvr.db3";Version=3;New=True;";
connection.Open();

Query some data:
Code:
                // load list of genre codes
                DbCommand command = dbProviderFactory.CreateCommand();
                command.Connection = connection;
                command.CommandText = "SELECT * from GENRE";                
                DbDataReader dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    string key = dataReader.GetString(dataReader.GetOrdinal("genre_name"));
                }
                dataReader.Close();

Close connection
Code:
connection.Close();
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#4
2008-03-21, 06:33 PM
sub Wrote:I dont have a convenient ready to use bit of code to cut and paste for you, but here is some bits that might piece together for something useful:

Setup DBProviderFactory (useful if you intend to introduce support for different DB types in future)
Code:
DbProviderFactory dbProviderFactory = new System.Data.SQLite.SQLiteFactory();

Create a database connection:
Code:
DbConnection connection = dbProviderFactory.CreateConnection();
connection.ConnectionString = "Data Source=".\gbpvr.db3";Version=3;New=True;";
connection.Open();

Query some data:
Code:
                // load list of genre codes
                DbCommand command = dbProviderFactory.CreateCommand();
                command.Connection = connection;
                command.CommandText = "SELECT * from GENRE";                
                DbDataReader dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    string key = dataReader.GetString(dataReader.GetOrdinal("genre_name"));
                }
                dataReader.Close();

Close connection
Code:
connection.Close();

Thanks. Now to get a good handle on this, that was C code right?. So I could in theory pop each snippet into a converter and add it to my code...

I'm using the new VB 2008 express. and I don't think I'm going to need more (I don't think so)

I know sharp Dev can convert back and forth.

Would anyone know if I would have better cross platform conversion if I downloaded the C# express too?
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#5
2008-03-21, 07:07 PM
In trying to take your code, I'm starting to suspect that the docs for my versiin I downloaded are not the same as yours. I'm still not sure, but I think there are a lot of 'shadow' declarations for backward compatibility.


Code:
Public Shadows ReadOnly Property Connection As SQLiteConnection

Would you happen to have the chm for the version you have implemented?
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#6
2008-03-21, 07:22 PM
I just read this from the Help:

Quote:Express Edition Limitations
All Express Editions (except Visual Web Developer) are hard-coded to only allow you to design for Jet and Sql Server Database Files. The only way for SQLite to install its designer is to temporarily replace one of the existing "approved" designers. Therefore, when you install the SQLite designer for one of these express editions, it will temporarily replace the Microsoft Access designer. You can revert back to the Access designer simply by re-running the install.exe program and un-checking the boxes.

Now from another thread, I read that sub doesn't use the sqlite syntax but rather the generic data access stuff. Is that killed by this substitution?
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#7
2008-03-21, 08:00 PM
Thanks. You got me going all right. Stirred me rather... (the down under meaning of stirred)

I'm off
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#8
2008-03-21, 09:52 PM
A couple of questions. As I start to use .net, I'm trying to unlearn bad habits. Certainly it's forcing me to define everything.

Code:
SQL_connection.ConnectionString = "Data Source=" & GBPVRdb3 & ";Version=3;New=True;"
        SQL_connection.Open()

        Dim command As DbCommand = DbProviderFactory.CreateCommand()
        command.Connection = SQL_connection
        command.CommandText = "SELECT * from GENRE"
        Dim dataReader As DbDataReader = command.ExecuteReader()
        While dataReader.Read()
            Dim key0 As String = dataReader.GetValue(dataReader.GetOrdinal("oid"))
            Dim key1 As String = dataReader.GetValue(dataReader.GetOrdinal("genre_name"))
            Dim key2 As String = dataReader.GetValue(dataReader.GetOrdinal("argb_color"))
            MsgBox("add to array here: " & key0 & key1 & key2)
        End While
        dataReader.Close()

In the above example, I use a generic .getvalue that will take whatever type the data is and then it goes into a string. I suppsoe I could start to use specific datatypes. I know that VB6 is notorious for being slow when using variants. What do you all suggest?

Also, I'd like to pump the results into an array. Is it correct to grab each column of each line, like this and add to array, or is there a way to get the query results already in a two dimensional array...

THanks
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
zehd
Offline

Posting Freak

Posts: 5,119
Threads: 249
Joined: Feb 2006
#9
2008-03-21, 09:54 PM
zehd Wrote:A couple of questions. As I start to use .net, I'm trying to unlearn bad habits. Certainly it's forcing me to define everything.

Code:
SQL_connection.ConnectionString = "Data Source=" & GBPVRdb3 & ";Version=3;New=True;"
        SQL_connection.Open()

        Dim command As DbCommand = DbProviderFactory.CreateCommand()
        command.Connection = SQL_connection
        command.CommandText = "SELECT * from GENRE"
        Dim dataReader As DbDataReader = command.ExecuteReader()
        While dataReader.Read()
            Dim key0 As String = dataReader.GetValue(dataReader.GetOrdinal("oid"))
            Dim key1 As String = dataReader.GetValue(dataReader.GetOrdinal("genre_name"))
            Dim key2 As String = dataReader.GetValue(dataReader.GetOrdinal("argb_color"))
            MsgBox("add to array here: " & key0 & key1 & key2)
        End While
        dataReader.Close()

In the above example, I use a generic .getvalue that will take whatever type the data is and then it goes into a string. I suppsoe I could start to use specific datatypes. I know that VB6 is notorious for being slow when using variants. What do you all suggest?

Also, I'd like to pump the results into an array. Is it correct to grab each column of each line, like this and add to array, or is there a way to get the query results already in a two dimensional array...

THanks

Oh, and I suppose that if I keep the datatypes specific, I might not be able to use a array...
Frank Z
[COLOR="Gray"]
I used to ask 'why?' Now I just reinstall...
[SIZE="1"]______________________________________________
Author: ZTools: ZProcess, MVPServerChecker; UltraXMLTV Enhancer, Renamer, Manager; [/SIZE]
[/COLOR]
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#10
2008-03-21, 10:14 PM
zehd Wrote:Thanks. Now to get a good handle on this, that was C code right?. So I could in theory pop each snippet into a converter and add it to my code...

I'm using the new VB 2008 express. and I don't think I'm going to need more (I don't think so)
This code was C#. Its very similar to VB.NET, just a few minor syntax differences.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Starting the NPVR Built In Screensaver ACTCMS 2 1,614 2010-10-28, 05:55 PM
Last Post: ACTCMS
  .net / sqlite3 Date Types... zehd 4 4,619 2008-03-25, 01:36 AM
Last Post: zehd
  schedule a manual recording with sqlite3.exe jd142 4 2,227 2007-05-29, 09:13 PM
Last Post: sub
  Starting GBPVR with a different start page? gruskada 2 1,520 2006-02-01, 12:47 PM
Last Post: gruskada
  Starting a new skin chasef 16 4,902 2004-12-10, 07:57 PM
Last Post: sub

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

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

Linear Mode
Threaded Mode