System.Data.SQLite.SQLiteException (0x80004005): SQL logic error or missing database near ")": syntax error

0

I was trying to execute this sqlite database in C# visual studio windows application but whenever I try to enter value in text boxes this error occur if anyone have idea please help I am using sqlite studio.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;
namespace login_data
{
    public partial class Form1 : Form
    {
        string connectionString;
        public Form1()
        {
            InitializeComponent();
            connectionString = @"Data Source=D:\tirth doshi\codes\login data\Login.db;Version=3;New=True;Compress=True;";
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (SQLiteConnection sqlite_conn = new SQLiteConnection(connectionString))
            {
                sqlite_conn.Open();
                //     string connect= "INSERT Login WHERE textBox1= @UserName AND textBox2= @PassWord";
                SQLiteCommand cmd = new SQLiteCommand();

                cmd.CommandText = "insert into Login (UserName, PassWord,) values ('" + textBox1.Text + "','" + textBox2.Text + "');";
                cmd.Connection = sqlite_conn;
                cmd.Parameters.AddWithValue("@UserName", textBox1.Text);
                cmd.Parameters.AddWithValue("@PassWord", textBox2.Text);
                cmd.ExecuteNonQuery();
            }
        }
    }   
}
c#
database
sqlite
asked on Stack Overflow Feb 26, 2021 by user_1293

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0