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.
'Me.FooTableAdapter.Fill(Me.DataSet1.foo)
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
Try
strCommand = "SELECT * FROM [foo] LIMIT 0,1"
objDA = New SQLiteDataAdapter(strCommand, objConnection)
'objDA.Fill(objDS)
objDA.Fill(Me.DataSet1.foo)
If objDS.Tables(0).Rows.Count > 0 Then
DataGrid1.DataSource = objDS.Tables(0).DefaultView
End If
Catch ex As Exception
'錯誤控管
Finally
'清除資源
If Not objDS Is Nothing Then objDS.Dispose()
End Try
End Sub
Tuesday, July 22, 2008
SQLite 速記
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment