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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:28:42+00:00 2026-05-24T09:28:42+00:00

I have written dynamic insert part.When I excute he Insert statement into sqlite browser

  • 0

I have written dynamic insert part.When I excute he Insert statement into sqlite browser , its inserting fine.If do throuh code there are some issues:

This is my code:

  public void insertTableRecord(String strTableName, String strToFields, String strValues){
    DBAdapter dbAdapter = DBAdapter.getDBAdapterInstance(DownlaodTableActivity.this);
    dbAdapter.openDataBase();

    ContentValues initialValues = new ContentValues();
    initialValues.put(strToFields,strValues);
    long n = dbAdapter.insertRecordsInDB(strTableName, null, initialValues);
    System.out.println( " -- inserted status : --- " + n);
}

sql statement is :

        INSERT INTO  WMTransactionControl(ExecutiveCode,FreeIssuePrefix,DisPaySchedulePrefix,NextFreeIssueNo,NextReturnNo,UploadedType,DisNextFreeIssueNo,DisNextFOCNo,NextVisitNo,DisNextOrderNo,UploadedOn,NextReturnAcceptNo,BusinessUnit,TXNReferencePrefix,OrderPrefix,UploadedMethod,FOCPrefix,ReturnPrefix,RetailerPrefix,NextRetailerNo,NextInvoiceNo,NextGRNNo,InvoicePrefix,NextTXNReference,NextOrderNo,ReturnAcceptPrefix,PaySchedulePrefix,NextReceiptNo,NextFOCNo,NextPayScheduleNo,NextGRONo,DisReturnPrefix,DisReceiptPrefix,DisNextReturnNo,DisOrderPrefix,DisNextReceiptNo,DisNextPayScheduleNo,NextActivityNo,DisInvoicePrefix,DisNextInvoiceNo,UploadedBy,DisFreeIssuePrefix,DisFOCPrefix,ReceiptPrefix) VALUES("WAT2 "," ","","1","20","1","1","1","15","1","Jun 17 2011 6:33PM","1","HEMA","20110708 ","OR4 ","3"," ","RT4 ","TEM4","10","1","1","IN4 ","2","37"," ","PS4","1","20","41","1"," "," ","1"," ","1","1","1"," ","1","WAT2"," "," ","RP4 ");

This is sql statement i ran through sqlite browser. its ok.
but code
Error saying like this :

     08-02 12:25:35.447: ERROR/Database(304): Error inserting  ExecutiveCode,FreeIssuePrefix,DisPaySchedulePrefix,NextFreeIssueNo,NextReturnNo,UploadedType,DisNextFreeIssueNo,DisNextFOCNo,NextVisitNo,DisNextOrderNo,UploadedOn,NextReturnAcceptNo,BusinessUnit,TXNReferencePrefix,OrderPrefix,UploadedMethod,FOCPrefix,ReturnPrefix,RetailerPrefix,NextRetailerNo,NextInvoiceNo,NextGRNNo,InvoicePrefix,NextTXNReference,NextOrderNo,ReturnAcceptPrefix,PaySchedulePrefix,NextReceiptNo,NextFOCNo,NextPayScheduleNo,NextGRONo,DisReturnPrefix,DisReceiptPrefix,DisNextReturnNo,DisOrderPrefix,DisNextReceiptNo,DisNextPayScheduleNo,NextActivityNo,DisInvoicePrefix,DisNextInvoiceNo,UploadedBy,DisFreeIssuePrefix,DisFOCPrefix,ReceiptPrefix="WAT2 "," ","","1","20","1","1","1","15","1","Jun 17 2011 6:33PM","1","HEMA","20110708 ","OR4 ","3"," ","RT4 ","TEM4","10","1","1","IN4 ","2","37"," ","PS4","1","20","41","1"," "," ","1"," ","1","1","1"," ","1","WAT2"," "," ","RP4 "
     08-02 12:25:35.447: ERROR/Database(304): android.database.sqlite.SQLiteException: 1 values for 44 columns: , while compiling: INSERT INTO WMTransactionControl(ExecutiveCode,FreeIssuePrefix,DisPaySchedulePrefix,NextFreeIssueNo,NextReturnNo,UploadedType,DisNextFreeIssueNo,DisNextFOCNo,NextVisitNo,DisNextOrderNo,UploadedOn,NextReturnAcceptNo,BusinessUnit,TXNReferencePrefix,OrderPrefix,UploadedMethod,FOCPrefix,ReturnPrefix,RetailerPrefix,NextRetailerNo,NextInvoiceNo,NextGRNNo,InvoicePrefix,NextTXNReference,NextOrderNo,ReturnAcceptPrefix,PaySchedulePrefix,NextReceiptNo,NextFOCNo,NextPayScheduleNo,NextGRONo,DisReturnPrefix,DisReceiptPrefix,DisNextReturnNo,DisOrderPrefix,DisNextReceiptNo,DisNextPayScheduleNo,NextActivityNo,DisInvoicePrefix,DisNextInvoiceNo,UploadedBy,DisFreeIssuePrefix,DisFOCPrefix,ReceiptPrefix) VALUES(?);
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:36)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1536)
     08-02 12:25:35.447: ERROR/Database(304):     at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1410)
     08-02 12:25:35.447: ERROR/Database(304):     at com.xont.db.DBAdapter.insertRecordsInDB(DBAdapter.java:214)
     08-02 12:25:35.447: ERROR/Database(304):     at com.xont.controller.DownlaodTableActivity.insertTableRecord(DownlaodTableActivity.java:325)
     08-02 12:25:35.447: ERROR/Database(304):     at com.xont.controller.DownlaodTableActivity.loadDownloadData(DownlaodTableActivity.java:264)
     08-02 12:25:35.447: ERROR/Database(304):     at com.xont.controller.DownlaodTableActivity.onOptionsItemSelected(DownlaodTableActivity.java:204)
     08-02 12:25:35.447: ERROR/Database(304):     at android.app.Activity.onMenuItemSelected(Activity.java:2195)
     08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730)
      08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
     08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
     08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532)
     08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
     08-02 12:25:35.447: ERROR/Database(304):     at android.view.View$PerformClick.run(View.java:8816)
     08-02 12:25:35.447: ERROR/Database(304):     at android.os.Handler.handleCallback(Handler.java:587)
     08-02 12:25:35.447: ERROR/Database(304):     at android.os.Handler.dispatchMessage(Handler.java:92)
     08-02 12:25:35.447: ERROR/Database(304):     at android.os.Looper.loop(Looper.java:123)
     08-02 12:25:35.447: ERROR/Database(304):     at android.app.ActivityThread.main(ActivityThread.java:4627)
     08-02 12:25:35.447: ERROR/Database(304):     at java.lang.reflect.Method.invokeNative(Native Method)
     08-02 12:25:35.447: ERROR/Database(304):     at java.lang.reflect.Method.invoke(Method.java:521)
    08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    08-02 12:25:35.447: ERROR/Database(304):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    08-02 12:25:35.447: ERROR/Database(304):     at dalvik.system.NativeStart.main(Native Method)

strToFields = ExecutiveCode,FreeIssuePrefix,DisPaySchedulePrefix,NextFreeIssueNo,NextReturnNo,UploadedType,DisNextFreeIssueNo,DisNextFOCNo,NextVisitNo,DisNextOrderNo,UploadedOn,NextReturnAcceptNo,BusinessUnit,TXNReferencePrefix,OrderPrefix,UploadedMethod,FOCPrefix,ReturnPrefix,RetailerPrefix,NextRetailerNo,NextInvoiceNo,NextGRNNo,InvoicePrefix,NextTXNReference,NextOrderNo,ReturnAcceptPrefix,PaySchedulePrefix,NextReceiptNo,NextFOCNo,NextPayScheduleNo,NextGRONo,DisReturnPrefix,DisReceiptPrefix,DisNextReturnNo,DisOrderPrefix,DisNextReceiptNo,DisNextPayScheduleNo,NextActivityNo,DisInvoicePrefix,DisNextInvoiceNo,UploadedBy,DisFreeIssuePrefix,DisFOCPrefix,ReceiptPrefix

strValues = “WAT2 “,” “,””,”1″,”20″,”1″,”1″,”1″,”15″,”1″,”Jun 17 2011 6:33PM”,”1″,”HEMA”,”20110708 “,”OR4 “,”3″,” “,”RT4 “,”TEM4″,”10″,”1″,”1”,”IN4 “,”2″,”37″,” “,”PS4″,”1″,”20″,”41″,”1″,” “,” “,”1″,” “,”1″,”1″,”1″,” “,”1″,”WAT2″,” “,” “,”RP4 “

Please Help me this.

Thanks in advance..

  • 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-05-24T09:28:43+00:00Added an answer on May 24, 2026 at 9:28 am

    You have to put all column values like initialValues.put(strToFields,strValues);
    what you wrote gives only the value for a column.you have other column in the table.Pls put them like this

    int totalColumn=50;
    String columName[]=new String[totalColumn];
    //dynamically generating columnName;
    String values[]=new String[totalColumn];
    

    //dynamically generating values

    for(int i=0;i<totalColumn;i++)
     initialValues.put(columnName[i],values[i]);`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a piece of performance critical code written with pointers and dynamic memory.
I have written some code to create dynamic banners. It returns a bitmap variable.
I have a dynamic link library written in VC++6. I wrote some code with
I have written a small piece of code regarding the dynamic loading of assemblies
I have recently written a dynamic querying tool using expression trees and as I
I have a dynamic linked library written in C# 3.0. This library has a
I have written some code in my VB.NET application to send an HTML e-mail
I have written a dynamic database driven, object oriented website with an administration frontend
I have a native dynamic link library written in VC++6 and I do not
I have written a compiler for C that outputs byte code. The reason for

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.