English 中文(简体)
如何删除数据库 sqlite 返回的错误: 错误代码 = 1, msg = 表格 Customin_ details_ able 没有名为“ Card number” 的列 [已关闭]
原标题:how to remove an error in a Database sqlite returned: error code = 1, msg = table Customer_details_table has no column named "Card Number" [closed]

String sqlQueryToCreateUndergraduateDetailsTable = "create table if not exists " + TABLE_NAME_GPA + " ( " + BaseColumns._ID + " integer primary key autoincrement, " +"COLUMN_NAME" + " text not null, " +"COLUMN_SURNAME" + " text not null, " +"COLUMN_DATE_OF_BIRTH"+ "text not null, +"COLUMN_ADDRESS" +"text not null," +"COLUMN_EMAIL" +"text not null," +"COLUMN_PHONE_NUMBER" +"text not null," +"COLUMN_CITY" +"text not null," +"COLUMN_PTYE_PAYMENT" +"text not null," +"COLUMN_SHIPPING_TYPE" +"text not null," +"COLUMN_CARD_NUMBER" + "text not null," +"COLUMN_Password" +"text not null);";

我试图保存到数据库,但它给了我一个错误 说....error code = 1, msg = table Customin_ details_able 没有名为“信用卡号码”的栏目

最佳回答

表格或列名称中不能有空格。

更改为 Card_number Cardnumber , 并且应该有效 。

<强 > EDIT

看着错误和你说的原话 我认为你贴错了SQL

您向我们展示了表格创建 SQL, 但您却说“ 我试图保存 < 坚固> 到 < / 坚固> 数据库 ” 。 错误信息似乎显示它正在寻找列, 而不是试图创建列 。

我认为你需要查看插入或更新 SQL 方法, 在那里你可能会用手动输入, 而不是使用常数, 意外地放一个空格在那里 。

问题回答

我也不认为你想把常数放进"", 或者你没有常数吗?

它应该看起来像:

String sqlQueryToCreateUndergraduateDetailsTable = "create table if not exists  "
        + TABLE_CREDENTIALS + " ( " + BaseColumns._ID
        + " integer primary key autoincrement, " + COLUMN_NAME
        + " text not null, " + COLUMN_PASSWORD + " text not null);";

您的查询混乱。 您需要给列名称及其属性间留出空格 。

例如,以下各点:

... +"COLUMN_CARD_NUMBER" + "text not null," + ...

应该是这样:

... +"COLUMN_CARD_NUMBER " + "text not null," + ...

注意列名 后的空白空格





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签