Question How save Data in XamarinForm

MO555555557

New member
Joined
Sep 1, 2022
Messages
1
Programming Experience
Beginner
Hello everybody,

First, I'm really sorry, as you rapidly see, i'm not really good in English. So, sorry for my mistakes.

So : I want developp an android application to mesure all time that one person have done to do an activity. I have done my form without problem but I would like save the data and I don't know how do can I do.
I have try to create an Database SQlite but Don't have succeed, I've try to export in an file but again I've don't succeed And my deadline arrive...
Can you help me please ?
I'm with visual studio 2022, XamarinForms
Below, I post my code :
MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="App5.MainPage">

    <StackLayout>
        <Frame BackgroundColor="#2196F3" Padding="24" CornerRadius="0">
            <Label Text="Gestion Temps" HorizontalTextAlignment="Center" TextColor="White" FontSize="36"/>
        </Frame>

        <Entry x:Name="Bon"
               Placeholder="Bon"/>
        <Picker Title="Salarié">
            <Picker.Items>
                <x:String>Morgane</x:String>
                <x:String>Caroline</x:String>
            </Picker.Items>
        </Picker>
        <Picker Title="Activité">
            <Picker.Items>
                <x:String>1</x:String>
                <x:String>2</x:String>
            </Picker.Items>
        </Picker>
        <Button x:Name="Debut"
                Text="Début"
                HorizontalOptions="Center"
                WidthRequest="150"
                HeightRequest="50"
                Clicked="Debut_Clicked"/>
        <Button x:Name="Fin"
                Text="Fin"
                HorizontalOptions="Center"
                WidthRequest="150"
                HeightRequest="50"
                Clicked="Fin_Clicked"/>
        <Entry x:Name="Dbt"/>
        <Entry x:Name="Fn"/>
        <Button x:Name="Save"
                Text="Save"
                HorizontalOptions="Center"
                WidthRequest="150"
                HeightRequest="50"
                Clicked="Save_Clicked"/>
        <Editor x:Name="Test"/>



    </StackLayout>

</ContentPage>

and

MainPage.xaml.cs:
using SQLite;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlTypes;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Essentials;
using Xamarin.Forms;
using static System.Net.Mime.MediaTypeNames;

namespace App5
{
    public partial class MainPage : ContentPage
    {
        
        public MainPage()
        {
            InitializeComponent();

            var date1 = new DateTime(2008, 3, 1, 7, 0, 0);
            Console.WriteLine(date1.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR")));
            var Daten=DateTime.Now;
        }

        private void Debut_Clicked(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            Dbt.Text = DateTime.Now.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR"));
        }

        private void Fin_Clicked(object sender, EventArgs e)
        {
            Button button1 = (Button)sender;
            Fn.Text = DateTime.Now.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR"));
        }
        private void Save_Clicked(object sender, EventArgs e)
        {
            Button button2 = (Button)sender;

Thanks for all
 
I have try to create an Database SQlite but Don't have succeed, I've try to export in an file but again I've don't succeed
What errors were you getting when you were trying these?
 
Back
Top Bottom