Tuesday, July 22, 2008

SQLite 速記

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DataSet1.foo' table. You can move, or remove it, as needed.
Dim strCommand As String
Dim strConnect As String
Dim DataGrid1 As New DataGridView

strConnect = "Data Source=C:\vb08sbs\DannySQL\DannySQL\Data\aaa.db3"

Dim objConnection As SQLiteConnection = New SQLiteConnection(strConnect)
Dim objDS As DataSet = New DataSet
Dim objDA As SQLiteDataAdapter


strCommand = "SELECT * FROM [foo] LIMIT 0,1"

objDA = New SQLiteDataAdapter(strCommand, objConnection)


If objDS.Tables(0).Rows.Count > 0 Then

DataGrid1.DataSource = objDS.Tables(0).DefaultView

End If

Catch ex As Exception




If Not objDS Is Nothing Then objDS.Dispose()

End Try

End Sub

No comments: