|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
Here is some sample code to help people get SQLite up and running with VB.NET. I am using the SQLite.NET provider found here: http://sqlite.phxsoftware.com/This was tested on VB 2005.
Private Sub SQLiteTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SQLiteTest.Click
Dim i As Int32 'General counter
Dim Row As DataRow
'Open a connection
Dim Con As New SQLite.SQLiteConnection
Con.ConnectionString = "Data Source=C:\temp\test.db3;"
Con.Open()
'Fill a DataSet object
Dim Adapter As New SQLite.SQLiteDataAdapter("SELECT * FROM Customers", Con)
Dim ds As New DataSet
Adapter.FillSchema(ds, SchemaType.Mapped, "Customers")
Adapter.Fill(ds, "Customers")
'Display some data
Debug.Print("Total Rows: " & ds.Tables("Customers").Rows.Count)
i = 1 'Tracks the current record number
For Each Row In ds.Tables("Customers").Rows
Debug.Print(i & " Name: " & Row("Name") & " City: " & Row("City") & " State: " & Row("State"))
i += 1
Next
'Close the connection
Con.Close()
End Sub
|
|
|
|
|