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

  • Home
  • SEARCH
  • 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 7934115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:32:42+00:00 2026-06-03T21:32:42+00:00

here i am using sqlite data base .and code for this are here: using

  • 0

here i am using sqlite data base .and code for this are here:

using (SQLiteCommand cmd = new SQLiteCommand(query, conn))
{
    conn.Open();
    cmd.ExecuteNonQuery();

    cmd.CommandText = 
         "insert into users(name, password, priviledges) values(" +
          "'" + UsernameText.Text.Trim() + "', " + "'" + 
         QuickMethods.MD5(PasswordText.Password.Trim()) + "', " + "524287" + ")";
    cmd.ExecuteNonQuery();

    cmd.CommandText = "INSERT INTO company VALUES('name','" + CompanyName.Text.Trim() + "');";
    cmd.ExecuteNonQuery();

    cmd.CommandText = "INSERT INTO company VALUES('address','" + CompanyAddress.Text.Trim() + "');";
    cmd.ExecuteNonQuery();

    cmd.CommandText = "INSERT INTO company VALUES('phone','" + CompanyPhone.Text.Trim() + "');";
    cmd.ExecuteNonQuery();

    cmd.CommandText = "INSERT INTO company VALUES('email','" + CompanyEmail.Text.Trim() + "');";
    cmd.ExecuteNonQuery();

    conn.Close();
}

I got exception at line cmd.ExecuteNonQuery() how to solve it.

  • 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-03T21:32:44+00:00Added an answer on June 3, 2026 at 9:32 pm

    Your first cmd.ExecuteNonQuery(); is the culprit. The one below connection opening.

    I think it gives error there because command is not set till that time. Comment it and it should fine.

    EDIT

    If that did not work
    there can be 2 reasons for this problem.

    First – connection is made to the right database but there is no such table there.

    Second – connection is made to the wrong database. In such case it gives no error. It makes a database file at the specified location. Even Opens the database. But gives this error when fetching/updating data. In such case the specified location will contain a database of 0 KB.

    My Answer to this question will help you

    Note/Warning related to question, not related to answer:

    Always be aware of SQL Injection. Use Parameterised Query (the one with @).

    More on SQL Injection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is an extension to the one raised here: Using factory_girl in Rails
I am attempting to follow along to this tut: HERE but using a sprite
I'm using SQLite ( system.data.sqlite v. 1.0.60.0 ) on a Fluent NHibernate project. I
I am using sqlite database with my app following is my code which is
Here's a snippet of code from an sqlite database application I'm working on: my
I am using SQLAlchemy with declarative base and Python 2.6.7 to insert data in
I am creating a database in android using this code: public class PackageDBHelper extends
I have a program that accesses a database using SQLite. When I open a
I'm trying to save a sound as a ringtone in Android using this code.
Hello i am following this tutorial Using your own SQLite database in Android applications

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.