Pembuatan Database SQLite dengan VB.NET 2005

Tutorial ini mencoba menunjukkan bagaimana koneksi dengan SQLite dengan VB.NET 2005.
Kita membutuhkan sebuah DLL yang bernama System.Data.SQLite (http://sqlite.phxsoftware.com/) yang bersifat freeware…

Imports System.Data.SQLite
Imports System.IO

Private Sub btn_createdb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_createdb.Click

        'Save Dialog Box
        Dim f As New SaveFileDialog
        f.Filter = "SQLite 3 (*.db3)|*.db3|All Files|"
        f.ShowDialog()
        'Create Database
        Dim SQLconnect As New SQLite.SQLiteConnection()
        'Database Doesn't Exist so Created at Path
        SQLconnect.ConnectionString = "Data Source=" & f.FileName & ";"
        SQLconnect.Open()
        SQLconnect.Close()

    End Sub

Private Sub btn_tables_create_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_tables_create.Click

            Dim SQLconnect As New SQLite.SQLiteConnection()
            Dim SQLcommand As SQLiteCommand
            SQLconnect.ConnectionString = "Data Source=" & txt_dbpath.Text & ";"
            SQLconnect.Open()
            SQLcommand = SQLconnect.CreateCommand
            'SQL query to Create Table
            SQLcommand.CommandText = "CREATE TABLE " & txt_tables_name.Text & "(id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, description TEXT, image BLOB);"
            SQLcommand.ExecuteNonQuery()
            SQLcommand.Dispose()
            SQLconnect.Close()
End Sub

Selamat mencoba!

3 thoughts on “Pembuatan Database SQLite dengan VB.NET 2005

  1. hy….
    maaf saya imgim bertanya bagai mana pembuatan absensi menggunakan vb
    mohon petunjuknya,dan cra pembuatannya,
    terimakasih

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s