Hi. I created a small program which one uses the SQLite database. I have a simple table employees, composed of the name and password. I can not write sql script correctly. application code is:
Code:
Imports System.Data
Imports System.Data.SQLite
Code:
Public Class Form1

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim connec = New SQLite.SQLiteConnection()
        Dim myCommand As New SQLite.SQLiteCommand()
        Dim myData As SQLite.SQLiteDataReader
        Dim myAdapter As SQLite.SQLiteDataAdapter
        'Dim SQL As String

        Dim name As String = txtUser.Text
        'Dim password As String = txtPassword.Text
Try
            connec.ConnectionString = "Data Source=" & Application.StartupPath & "\employees.db3; FailIfMissing=True;"
            connec.Open()
            myCommand = connec.CreateCommand
            myCommand.CommandText = "SELECT name FROM user WHERE name = '" + txtUser.Text
            myData = myCommand.ExecuteReader()
            myData.Read()
            If myData.HasRows Then
                frmmain.Show()
                Me.Hide()

                myData.Close()
            Else
                MessageBox.Show("Error")
                myData.Close()

            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
please help me in this issue.
thank you.