第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

麻煩幫我找一下錯,我真的無能無力了,謝謝。

麻煩幫我找一下錯,我真的無能無力了,謝謝。

hyl_666 2016-11-08 21:45:29
?這是Java文件,類名是DatabaseHelpepackage com.example.database;import android.os.Bundle;import android.app.Activity;import android.content.Context;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteDatabase.CursorFactory;import android.database.sqlite.SQLiteOpenHelper;import android.view.Menu;public class DatabaseHelper extends SQLiteOpenHelper{private static final int VERSION=1;public? DatabaseHelper(Context context,String name,CursorFactory factory,int version){?super(context,name,factory,version);?}public? DatabaseHelper(Context context,String name){?this(context,name,VERSION);?}public? DatabaseHelper(Context context,String name,int version){?this(context,name,null,version);?}?? public void onCreate(SQLiteDatabase db) {?? System.out.println("create a Database");?? db.execSQL("create table user(id int,name varchar(20))");??? }?? public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion) {??? System.out.println("update a Database");???? }}這是另一個Java文件,類名是SQLiteActivitypackage com.example.database;import android.app.Activity;import android.content.ContentValues;import android.content.DialogInterface.OnClickListener;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.os.Bundle;import android.view.View;import android.widget.Button;public class SQLiteActivity extends Activity{private Button? button1;private Button? button2;private Button? button3;private Button? button4;private Button? button5;protected void onCreate(Bundle saveInstanceState){?super.onCreate(saveInstanceState);?setContentView(R.layout.main);?button1=(Button) findViewById(R.id.button1);?button2=(Button) findViewById(R.id.button2);?button3=(Button) findViewById(R.id.button3);?button4=(Button) findViewById(R.id.button4);?button5=(Button) findViewById(R.id.button5);?button1.setOnClickListener(new CreatdbOnClickListener());?button2.setOnClickListener(new UpdatedbOnClickListener());?button3.setOnClickListener(new InsertOnClickListener());?button4.setOnClickListener(new UpdatedbOnClickListener());?button5.setOnClickListener(new QuerryOnClickListener());}class CreatdbOnClickListener implements OnClickListener{?public void onClick(View v){??DatabaseHelper dbHelper=new DatabaseHelper(SQLiteActivity.this,"test.db");??SQLiteDatabase db=dbHelper.getReadableDatabase();?}?}class UpdateOnClickListener implements OnClickListener{?public void onClick(View v){??DatabaseHelper dbHelper=new DatabaseHelper(SQLiteActivity.this,"test.db",2);??SQLiteDatabase db=dbHelper.getReadableDatabase();?}}class InsertOnClickListener implements OnClickListener{?public void onClick(View v){??ContentValues cv=new ContentValues();??cv.put("id", 1);??cv.put("name", "hyl");??DatabaseHelper dbHelper=new DatabaseHelper(SQLiteActivity.this,"test.db",2);??SQLiteDatabase db=dbHelper.getReadableDatabase();??db.insert("user",null,cv);?}?}class UpdatOnClickListener implements OnClickListener{?public void onClick(View v){??DatabaseHelper dbHelper=new DatabaseHelper(SQLiteActivity.this,"test.db",2);??SQLiteDatabase db=dbHelper.getWritableDatabase();??ContentValues values=new ContentValues();??values.put("name","heyulu");??db.update("user",values,"id=?",new String[] {"1"});??System.out.println("----------------update------------");?}?}class QuerryOnClickListener implements OnClickListener{?public void onClick(View v){??DatabaseHelper dbHelper=new DatabaseHelper(SQLiteActivity.this,"test.db",2);??SQLiteDatabase db=dbHelper.getWritableDatabase();??Cursor cursor=db.query("user",new String[]{"id","name"},"id=?",new String[]{"1"},null,null,null);??while(cursor.moveToNext()){???String name=cursor.getString(cursor.getColumnIndex("name"));???System.out.println("query--->"+name);??}?}}}還有一個xml文件<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"??? android:layout_width="match_parent"???? android:layout_height="match_parent"????? android:orientation="vertical"><Button???? android:id="@+id/button1"???? android:layout_width="fill_parent"???? android:layout_height="wrap_content"???? android:text="@string/creatdb"??? /><Button???? android:id="@+id/button2"???? android:layout_width="fill_parent"???? android:layout_height="wrap_content"???? android:text="@string/updatedb"??? /><Button???? android:id="@+id/button3"???? android:layout_width="fill_parent"???? android:layout_height="wrap_content"???? android:text="@string/ins"??? /><Button???? android:id="@+id/button4"???? android:layout_width="fill_parent"???? android:layout_height="wrap_content"???? android:text="@string/upd"??? /><Button???? android:id="@+id/button5"???? android:layout_width="fill_parent"???? android:layout_height="wrap_content"???? android:text="@string/que"??? /></LinearLayout>
查看完整描述

1 回答

?
喬小欠兒

TA貢獻18條經(jīng)驗 獲得超15個贊

錯誤log也貼上來啊

查看完整回答
反對 回復(fù) 2016-11-09
  • 1 回答
  • 0 關(guān)注
  • 1308 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號