我正在将数据表连接到datagridview。一旦我运行它,它就会在datagridview中显示一个数据表。 (它确实如此)只是因为我似乎无法删除行!
最后一行代码是完整按钮 如果要将数据表连接到datagridview,我找不到这样做的方法。我填写的表名为JANITOR,我能够很好地连接到它。
这是我的代码。 (我没有错误,但它不起作用)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cdd2ea"
android:id="@+id/RL"
android:orientation="vertical"
android:weightSum="1">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/sv"
android:fillViewport="true"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_above="@+id/buttonAddRecipes">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/l_layout"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Add a New Recipe"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Food Category :"
android:id="@+id/textView11"
android:layout_marginTop="25dp"
android:layout_below="@+id/textView"
android:layout_alignParentStart="true"
android:layout_marginStart="47dp" />
<Spinner
android:layout_width="244dp"
android:layout_height="match_parent"
android:id="@+id/spinnerFoodCat"
android:entries="@array/Food_Cat"
android:layout_gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Meal Category :"
android:id="@+id/textView12"
android:layout_marginTop="25dp"
android:layout_below="@+id/textView"
android:layout_alignParentStart="true"
android:layout_marginStart="47dp" />
<Spinner
android:layout_width="244dp"
android:layout_height="match_parent"
android:id="@+id/spinnerMealCat"
android:layout_gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Recipe Name :"
android:id="@+id/textView13"
android:layout_marginTop="25dp"
android:layout_below="@+id/spinner"
android:layout_alignParentStart="true"
android:layout_marginStart="47dp" />
<EditText
android:layout_width="271dp"
android:layout_height="match_parent"
android:id="@+id/RecipeName"
android:hint="Enter Recipe Name"
android:layout_below="@+id/textView13"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Main Ingredients:"
android:id="@+id/textView15"
android:layout_marginStart="47dp" />
<LinearLayout
android:orientation="vertical"
android:id="@+id/chk_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/sup_ingTextView"
android:layout_marginStart="47dp" />
<LinearLayout
android:orientation="vertical"
android:id="@+id/chk_layout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
<TextView
android:layout_width="303dp"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Instructions :"
android:id="@+id/textView17"
android:layout_marginTop="25dp"
android:layout_below="@+id/textView15"
android:layout_alignParentStart="true"
android:layout_marginStart="25dp"
android:layout_marginRight="20dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/RecipeTextArea"
android:editable="true"
android:layout_marginTop="25dp"
android:enabled="true"
android:minLines="6"
android:maxLines="6"
android:isScrollContainer="true"
android:hint="Enter Recipe Instructions here."
android:background="#fafafa"
android:textIsSelectable="true"
android:focusable="true"
android:gravity="top"
android:padding="24dp"
style="@style/Base.TextAppearance.AppCompat.Large"
/>
</LinearLayout>
</ScrollView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Recipe"
android:id="@+id/buttonAddRecipes"
android:capitalize="words"
android:clickable="true"
android:longClickable="false"
android:background="#4052b5"
android:textColor="#fefefe"
android:textSize="@dimen/abc_select_dialog_padding_start_material"
android:onClick="btnAddRecipes"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>