You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

Imports System.Data.SQLite
Imports System.IO
Imports MetroFramework.Forms
Public Class Import
Inherits MetroFramework.Forms.MetroForm
Private Sub ImportMusic_Click(sender As System.Object, e As System.EventArgs) Handles ImportMusic.Click
Me.Cursor = Cursors.WaitCursor
Dim dirPath As DirectoryInfo = New DirectoryInfo(tbFileName.Text + "\")
For Each file As FileInfo In dirPath.GetFiles("*.cdg*", SearchOption.AllDirectories)
Dim sqlConnection As New SQLite.SQLiteConnection()
Dim sqlCommand As New SQLiteCommand("", sqlConnection)
sqlConnection.ConnectionString = "Data Source=" + Application.StartupPath + "\karaoke.db"
sqlCommand.CommandText = "INSERT INTO karaoke(song,location) VALUES('" & file.Name.Replace("'", "''") & "', '" & file.FullName.Replace("'", "''") & "');"
Me.Cursor = Cursors.Default
End Sub
Private Sub btBrowse_Click(sender As System.Object, e As System.EventArgs) Handles btBrowse.Click
tbFileName.Text = FolderBrowserDialog1.SelectedPath
End Sub
End Class