NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 80 81 82 83 84 … 159 Next »
SQLite with VB .Net

 
  • 0 Vote(s) - 0 Average
SQLite with VB .Net
taz
Offline

Member

Posts: 102
Threads: 30
Joined: May 2006
#1
2007-11-02, 05:35 PM
Does anyone have a sample application with VB .Net and a SQLite database? I am having trouble figuring out what the correct database connection is (where the database isn't always in the same location).

Thanks,
Taz
systemshark
Offline

Senior Member

Posts: 566
Threads: 56
Joined: Oct 2005
#2
2007-11-02, 07:14 PM (This post was last modified: 2007-11-03, 07:23 AM by systemshark.)
Taz,

I write in both VB.NET and C#...

Here's a chuck of my code from my Sky Channel Tool Logo which connected to GBPVR Database in Vb.net

imports system.data.sqlite

Public Demo
Public Sub DemoCode
Try
Dim dr As System.Data.DataTableReader
Dim dr2 As System.Data.DataTableReader
Dim ds As New DataSet
Dim ds2 As New DataSet
Dim da As New SQLiteDataAdapter
Dim Conn As New SQLiteConnection
'Dim dbpath As String = Me.TextBox2.Text
Dim sqlCmd As New SQLiteCommand
Dim UpdateCmd As New SQLiteCommand

Dim mysql As String

Dim iloop As Integer
Dim aResult() As String
Dim iPos As Integer

Dim sChannelID As String
Dim sChannelname As String

' Default Connection string looks like:- "Data Source=C:\program files\Devnz\GBPVR\GBPVR.DB3;Compress=False;Synchronous=Off"

Conn.ConnectionString = GBPVRInfo.GBPVRDBConnectionString

SCSError.WriteToErrorLog("OpenSQLLite-Connecting to Database " & GBPVRInfo.GBPVRDBConnectionString, "Download", "SkyChannelSync")

Conn.Open()

Dim strSQL As String = "SELECT rowid as RowID,CHANNEL.Channel_Number,Channel.Name,Channel.OID FROM CHANNEL"
SCSError.WriteToErrorLog("OpenSQLLite-Connecting to Database", "Download", "SkyChannelSync")
sqlCmd.CommandText = strSQL
sqlCmd.CommandType = CommandType.Text
sqlCmd.Connection = Conn

da.SelectCommand = sqlCmd
SCSError.WriteToErrorLog("OpenSQLLite-Reading Records", "Download", "SkyChannelSync")
da.Fill(ds)
sChannelID = ""
dr = ds.CreateDataReader
While dr.Read()

SyncForm.Refresh()
Regards Systemshark
[COLOR="Silver"]
Lounge: HDPC Intel i5, Asus Motherboard with Intel HDMI, 4Gb of Ram, 1Tb Disk, 60Gb SSD, Blackgold BT3595 Tuner, Hauppauge Nova T500 and HVR1700 in a LianLi C39 B Case.

Other Room : Liteon Wireless Media Centre/DVD Player

Software : Windows7 32 Bit, RedRat, XMLTV GUI and NPVR
[/COLOR]
taz
Offline

Member

Posts: 102
Threads: 30
Joined: May 2006
#3
2007-11-03, 09:33 PM
Thank you! I will give that a try. Smile

Taz
saintjo
Offline

Junior Member

Posts: 14
Threads: 3
Joined: Nov 2007
#4
2007-11-07, 08:45 PM
Also, dont forget to dispose your SQLLite objects. They are technically calling into unmanaged code and dont always clean up well after themselves. Probably not an issue for what you are programming, but its a good habit to get into.

You can also use the Using () command if you are doing C#. Its just easier to read and fills in the dispose and finalizers for you in the IML code.
My programming resource/webpage is www.StlDev.com
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  sqlite database modifications skippy_nz 19 5,977 2009-04-09, 03:52 AM
Last Post: wtg
  SQLite manager plugin for firefox martint123 1 2,033 2008-03-13, 04:14 AM
Last Post: JavaWiz
  SQLite Expert Personal and AVG Free ACTCMS 1 1,855 2007-12-01, 09:11 PM
Last Post: martint123
  Can you Browse the SQLite DataBase? Pioneer4x4 15 7,040 2006-09-15, 09:14 PM
Last Post: Pioneer4x4
  SQLite DB editor bgowland 3 2,242 2006-05-20, 09:29 PM
Last Post: ubu

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

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

Linear Mode
Threaded Mode