Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:08:15+00:00 2026-06-18T06:08:15+00:00

I am trying to develop a simple application with a simple SQLite database. I

  • 0

I am trying to develop a simple application with a simple SQLite database. I am new to C# so I may have missed something obvious. When I run the following code, it returns the error:

SQL logic error or missing database.No such table: Customer
(edit: Yes I have created that table within the database, I performed/confirmed this using the sqlite command prompt

Here is my code:

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SQLite;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace TestPersonDatabase
{
public partial class DBconnection : Form
{
    SQLiteDatabase sqliteDb = new SQLiteDatabase();

    public DBconnection()
    {
        InitializeComponent();
    }

    // Using SQLite
    private void btnInsert_Click(object sender, EventArgs e)
    {

        Dictionary<String, String> data = new Dictionary<String, String>();
        data.Add("CustomerId", this.fieldInsertId.Text);
        data.Add("FirstName", this.fieldInsertFName.Text);
        data.Add("LastName", this.fieldInsertLName.Text);
        data.Add("MobileNumber", this.fieldInsertDob.Text);

        try 
        {
            sqliteDb.Insert("Customer", data);
        }
        catch(Exception error)
        {
            MessageBox.Show(error.Message);
        }
    }
}


class SQLiteDatabase
{    String dbConnection;

public SQLiteDatabase()
{
    dbConnection = "Data Source=" + (global::TestPersonDatabase.Properties.Resources.database);
}


    public bool Insert(String tableName, Dictionary<String, String> data)
{
    String columns = "";
    String values = "";
    Boolean returnCode = true;
    foreach (KeyValuePair<String, String> val in data)
    {
        columns += String.Format(" {0},", val.Key.ToString());
        values += String.Format(" '{0}',", val.Value);
    }
    columns = columns.Substring(0, columns.Length - 1);
    values = values.Substring(0, values.Length - 1);
    try
    {
        this.ExecuteNonQuery(String.Format("insert into {0}({1}) values({2});", tableName, columns, values));
    }
    catch (Exception fail)
    {
        MessageBox.Show(fail.Message);
        returnCode = false;
    }
    return returnCode;
}

Obviously the code above is two different classes put together. Just made it easier for you to read.

It seems like it cannot find the database file. But I appear to have linked it up correctly (its in the solution resources). Any help would be very much appreciated as I am a bit stumped! Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:08:17+00:00Added an answer on June 18, 2026 at 6:08 am

    You never opened your sql connection try:

      dbConnection.Open();  //Initiate connection to the db
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a simple database application, I wish to use RMI
I am new in SignalR and I am trying to develop simple chat application
I'm trying to develop a simple kernel using TASM, using this code: ; beroset.asm
I'm trying to develop a simple php based schedule ... This is my database
I am trying to develop a simple application in C# to count the number
I am trying to develop a simple map application, which will display a map
I am trying to develop one simple application using Java, Flex and Blazeds. I
I'm trying to develop a simple application with mongoose. Given an array of username
I'm learning Objective-C and trying to develop a simple zipper application, but I stopped
I'm trying to develop a simple spring 3 web application with a connection to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.