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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:03:18+00:00 2026-06-04T10:03:18+00:00

public class DBAdapter { public static final String COLUMN_ID = ID; public static final

  • 0
public class DBAdapter {
    public static final String COLUMN_ID = "ID";
    public static final String COLUMN_NAME = "NAME";
    public static final String COLUMN_SURNAME = "SURNAME";
    public static final String COLUMN_DATE_OF_BIRTH = "DateOfBirth";
    public static final String COLUMN_ADDRESS = "HomeAddress";
    public static final String COLUMN_EMAIL = "EmailNO";

    public static final String COLUMN_PHONE_NUMBER = "PhoneNumber";
    public static final String COLUMN_CITY = "City";
    public static final String COLUMN_PTYE_PAYMENT = "TypePayment";
    public static final String COLUMN_SHIPPING_TYPE = "ShippingType";
    public static final String COLUMN_CARD_NUMBER = "CardNumber";   
    public static final String COLUMN_username = "Username";
    public static final String COLUMN_Password = "Passwords";   

    public static final String TAG = "DBAdapter";

   private static final String DATABASE_NAME = "Computer_Info.db";
   private static final String USERS_TABLE = "DetailsCustomer";
   private static final int DATABASE_VERSION = 3;

private final Context context;

private DatabaseHelper DBHelper;
private SQLiteDatabase db;

public DBAdapter (Context ctx) 
{
    this.context = ctx;
    DBHelper = new DatabaseHelper(context);
}

private static class DatabaseHelper extends SQLiteOpenHelper
{
    DatabaseHelper(Context context) {
         super (context,DATABASE_NAME,null,DATABASE_VERSION);
    }

@Override
 public void onCreate(SQLiteDatabase db)
{



try {
          //db.execSQL(DATABASE_CREATE);        
         db.execSQL("CREATE TABLE "+ USERS_TABLE + 
                    "("+ COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                    COLUMN_NAME + " TEXT, " + COLUMN_SURNAME +" TEXT, " +COLUMN_DATE_OF_BIRTH+

                   " TEXT NOT NULL, " + COLUMN_ADDRESS + " TEXT, " + COLUMN_EMAIL +" TEXT, " + 
                   COLUMN_PHONE_NUMBER + " TEXT, "+ COLUMN_CITY + " TEXT, "+ COLUMN_PTYE_PAYMENT +
                   " TEXT, " + COLUMN_CARD_NUMBER + " TEXT,"+ COLUMN_username + "TEXT ," + COLUMN_Password +" TEXT)");

} 



 catch (SQLException e) {
           e.printStackTrace();

       }
    }

public long insertRecord(String NAME, String SURNAME, String DateOfBirth,
         String HomeAddress,String EmailNO,  String PhoneNumber,  String City,
         long l, long m,String CardNumber,String Username, String Passwords) {
    {


            ContentValues initialValues = new ContentValues();


    initialValues.put(COLUMN_NAME,NAME);
    initialValues.put(COLUMN_SURNAME,SURNAME);
    initialValues.put(COLUMN_DATE_OF_BIRTH,DateOfBirth);
    initialValues.put(COLUMN_ADDRESS,HomeAddress);
    initialValues.put(COLUMN_EMAIL,EmailNO);
    initialValues.put(COLUMN_PHONE_NUMBER,PhoneNumber);
    initialValues.put(COLUMN_CITY,City);
    initialValues.put(COLUMN_PTYE_PAYMENT,l);
    initialValues.put(COLUMN_SHIPPING_TYPE,m);
    initialValues.put(COLUMN_CARD_NUMBER,CardNumber);
    initialValues.put(COLUMN_username,Username);
    initialValues.put(COLUMN_Password,Passwords);

            return db.insert(USERS_TABLE,null, initialValues);

       }

   }

public long insertRecord(String nAME, String sURNAME, String dateOfBirth,
        String homeAddress, String emailNO, String phoneNumber, String city,
        String string, String string2, String cardNumber, String Username, String Passwords) {
    return 0;   

    }

and also my Activity class————————–

public void buttonRegister(View v)
    {
        Log.d("test", "adding"); 

        //get data from form
        EditText nametext = (EditText)findViewById(R.id.editTextName);
        EditText Surnametext = (EditText)findViewById(R.id.editTextSurname);
        EditText DOBtext = (EditText)findViewById(R.id.editTextDateBirth);
        EditText Adresstext = (EditText)findViewById(R.id.editTexAddress);
        EditText EmailNotext = (EditText)findViewById(R.id.editTeEmail);
        EditText Phonetext = (EditText)findViewById(R.id.editTexPhone);
        EditText Citytext = (EditText)findViewById(R.id.editTextCITY);
        Spinner PaymentSpinner = (Spinner)findViewById(R.id.spinnerPayment);
        Spinner ShippngMethod = (Spinner)findViewById(R.id.spinnerShipping);
        EditText CardNumbertext = (EditText)findViewById(R.id.editTextCARDNUMBER);
        EditText usernametext = (EditText)findViewById(R.id.txtusername);
        EditText pasword = (EditText)findViewById(R.id.editTexpassword);




db.open();
        long id = db.insertRecord(nametext.getText().toString(), Surnametext.getText().toString(),
                                   DOBtext.getText().toString(),Adresstext.getText().toString(),EmailNotext.getText().toString(),
                                   Phonetext.getText().toString(), Citytext.getText().toString(),
                                   PaymentSpinner.getSelectedItemId(), ShippngMethod.getSelectedItemId(), CardNumbertext.getText().toString(),
                                   usernametext.getText().toString(), pasword.getText().toString());




db.close();

        nametext.setText("");
        Surnametext.setText("");
        DOBtext.setText("");
        Adresstext.setText("");
        EmailNotext.setText("");
        Phonetext.setText("");     
        Citytext.setText("");
        PaymentSpinner.setId(0);
        ShippngMethod.setId(0);
        CardNumbertext.setText("");
        usernametext.setText("");
        pasword.setText("");





Toast.makeText(Regist.this,"Customer has been Registered",Toast.LENGTH_LONG).show();       

       }

I’m trying to insert into a database but it telling me there in column name Username… which I don’t get why it happening please 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-04T10:03:21+00:00Added an answer on June 4, 2026 at 10:03 am

    It is correct, that column doesn’t exist because of this bit in the string where you create the database:

    COLUMN_username + "TEXT ," 
    

    You are missing a space. It should be:

    COLUMN_username + " TEXT ," 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class TestBL { public static void AddFolder(string folderName) { using (var ts =
public class Order { static Customer cust = new Customer(); string sEmpty = ;
public class MySingletonClass { public MySingletonClass() { _mySingletonObj = Instance(); } public static MySingletonClass
public class Test extends Thread{ public void hello(String s){ System.out.println(s); } public void run(){
I have a class: public class DbAdapter { private DbHelper dbHelper; private SQLiteDatabase db;
public class Options { public FolderOption FolderOption { set; get; } public Options() {
public class A { //some fields (may not only primitive types) and methods here}
public class UploadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { ... // Create
public class ToolPartGetLists : Microsoft.SharePoint.WebPartPages.WebPart, ICommunicationInterface { private bool _error = false; //......... protected
public class Ex7 { private int fld; private void meth(int val) { fld =

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.