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 9320441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:38:03+00:00 2026-06-19T03:38:03+00:00

Here is my code for the dbHelper class: package com.example.emp_management; import android.content.ContentValues; import android.content.Context;

  • 0

Here is my code for the dbHelper class:

package com.example.emp_management;


import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

public DatabaseHelper(Context context) {
    super(context, dbName, null, 1);
    // TODO Auto-generated constructor stub
}
static final String dbName="EmployeeManagementSystem";
static final String Login_Table="Login_Authentication";
static final String colID="ID";
static  final String colUsername="Username";
static final String colPassword="Passwrod";

@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
//db.execSQL("CREATE TABLE" + Login_Table+ "(" +
    //       colID + "INTEGER PRIMARY KEY AUTOINCREMENT, " +
        //  colUsername + "TEXT NOT NULL," +
          // colPassword + "TEXT NOT NULL);"                    
            //);
//db.execSQL("CREATE TABLE "+Login_Table+" ("+colID+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"+
    //    colUsername+ " TEXT ,"+ colPassword + "TEXT");
db.execSQL("CREATE TABLE " + Login_Table + "(colID INTEGER PRIMARY KEY AUTOINCREMENT, colUsername TEXT NOT NULL,colPassword TEXT NOT NULL);");
Log.w("Come aww man", "Database Table Created!!");


}
    @Override
   public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE IF EXISTS " + "Login_Authentication");
onCreate(db);
}
public void insert_new_user(String username,String password)
{
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues cv = new ContentValues();
    cv.put(DatabaseHelper.colUsername,username);
    cv.put(DatabaseHelper.colPassword,password);
    db.insert(Login_Table, null, cv);
    db.close();
    }
}

Here is the code am using to add new employee into the table i have created:

 package com.example.emp_management;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class Adding_Employee extends Activity{

@Override
protected void onCreate(Bundle aglakaam) {
    // TODO Auto-generated method stub
    super.onCreate(aglakaam);

    setContentView(R.layout.add_employee);
    final EditText new_user = (EditText) findViewById(R.id.editText1);
    final EditText new_pass = (EditText) findViewById(R.id.editText2);
    final Button create_acc = (Button) findViewById(R.id.creat_acc);

    create_acc.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        DatabaseHelper accessing_db = new DatabaseHelper(Adding_Employee.this);
        accessing_db.insert_new_user(new_user.getText().toString(), new_pass.getText().toString());
        Toast.makeText(getApplicationContext(), "New User Has Been Created!!", Toast.LENGTH_SHORT).show();

    }
});
}


}

And here is my logcat:

02-20 02:42:26.491: E/Database(384): Error inserting Passwrod=1234 Username=sjdf
02-20 02:42:26.491: E/Database(384): android.database.sqlite.SQLiteException: table     Login_Authentication has no column named Passwrod: , while compiling: INSERT INTO Login_Authentication(Passwrod, Username) VALUES(?, ?);
02-20 02:42:26.491: E/Database(384):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)

Something wierd here to me here is that the column of username exists. Why is it only showing exception for password and not username and even when password column exists why is the exception thrown here. Kindly help me!

  • 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-19T03:38:04+00:00Added an answer on June 19, 2026 at 3:38 am

    You are creating columns with the names colPassword , colUsername , and colID

    db.execSQL("CREATE TABLE " + Login_Table + "(colID INTEGER PRIMARY KEY AUTOINCREMENT, colUsername TEXT NOT NULL,colPassword TEXT NOT NULL);");
    

    and then trying to access them using

    static final String colID="ID";
    static  final String colUsername="Username";
    static final String colPassword="Passwrod"; 
    

    Since Passwrod != colPassword .. of course you won’t be able to find that column.

    Try something like this to ensure you are using the same names for columns when creating the table along with accessing it.
    You’ll need to increase your DB version in order for the changes to show.

    db.execSQL("CREATE TABLE " + Login_Table + "(" + colID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + colUsername + " TEXT NOT NULL," + colPassword + " TEXT NOT NULL);");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code for my db class: package one.two; import java.util.List; import android.app.ListActivity;
Here my code, I need to insert into mysql database I have mysql,php,android 1)
Here is code example class A{ int i; public: A(int i) : i(i) {}
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
My code here works fine to get the content length, and tells me how
Exception: CREATE TABLE android_metadata failed Failed to setLocale() when constructing, closing the database android.database.sqlite.SQLiteException:
I am having trouble with storing integer value in SQLite database. Here are my
In my app I have a dbhelper class where everything in my database happens,
Hey all Im a newbie Androidian, and would love some help with this? android.database.sqlite.SQLiteException:
This code below works with both a DAO and dBhelper class. I have 3

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.