How to save and clean a specific database if there are 2 or more data models in one database file.
previously I have created a data model as below. I have successfully loaded the data into a listView for the public class student.
Then, how do you access data from a public class school that is only input once without using a listView and PrimaryKey?
- using SQLite;
- using System;
- namespace SchoolData.Models {
- public class Student {
- [PrimaryKey, AutoIncrement] public int IdSis {
- get;
- set;
- }
- public DateTime Date {
- get;
- set;
- }
- public string PicStudent {
- get;
- set;
- }
- }
- public class School {
- public string SchoolName {
- get;
- set;
- }
-
- public string Address {
- get;
- set;
- }
- public string Vision {
- get;
- set;
- }
- }
- }
XamlPage code overview:
- <StackLayout>
- <Label Text="School Name:"/>
- <Entry Text="{Binding SchoolName}"/>
- <Label Text="Address:"/>
- <Entry Text="{Binding Address}"/>
- <Label Text="Vision:"/>
- <Entry Text="{Binding Vision}"/>
- <Button Text="Save" Clicked="SaveClick"/>
-
- <Button Text="Clear" Clicked="ClearClick"/>
- </StackLayout>
Thank's.