Skip to main content
se eliminaron 123 caracteres en el cuerpo; etiquetas editadas
Origen Enlace
gbianchi
  • 20.6k
  • 13
  • 40
  • 60

public CitaInfo(int ID, string dt) {
  InitializeComponent();
  memberDatabase = new MemberDatabase();
  var citaunica = memberDatabase.CitaUnica(ID);
  ListCitaUnica.ItemsSource = citaunica;
  //DateTime dtx = DateTime.Parse(dt);


}
//Citas crud local
public string AddCita(Cita cita) {
  conn.Insert(cita);
  return "success :3 ";
}

public void DeleteCita(int ID) {
  conn.Delete<Cita>(ID);
}

public Cita CitaUnica(int ID) {
  Cita citaunica=conn.Table<Cita>().FirstOrDefault( ci=> ci.ID==ID);
  return citaunica;
  //return citaunica;
}

public IEnumerable<Cita>GetCitas() {
  var citasx=(from cit in conn.Table<Cita>() select cit);
  return citasx.ToList();
}
<ScrollView>
  <Grid>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Margin="10" x:Name="lbl_txt" Text="Datos de Orden" FontSize="25" />

      <ListView x:Name="ListCitaUnica" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid Padding="10">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />

                </Grid.RowDefinitions>


                <Label Text="Fecha" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="2" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding razon}" HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />


                <Label Text="Orden" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="3" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding descripcion}" HorizontalOptions="CenterAndExpand" Grid.Row="3" TextColor="Blue" Grid.Column="1" FontAttributes="Bold" />


                <Label Text="Itinerario" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="4" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding fecha}" HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />

                <Label Text="Medio " FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="5" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding hora}" HorizontalOptions="CenterAndExpand" Grid.Row="5" TextColor="Orange" Grid.Column="1" FontAttributes="Bold" />



              </Grid>
            </ViewCell>

          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>




    </Grid>

  </Grid>

</ScrollView>
public CitaInfo(int ID, string dt) {
  InitializeComponent();
  memberDatabase = new MemberDatabase();
  var citaunica = memberDatabase.CitaUnica(ID);
  ListCitaUnica.ItemsSource = citaunica;
  //DateTime dtx = DateTime.Parse(dt);


}

 
//Citas crud local
public string AddCita(Cita cita) {
  conn.Insert(cita);
  return "success :3 ";
}

public void DeleteCita(int ID) {
  conn.Delete<Cita>(ID);
}

public Cita CitaUnica(int ID) {
  Cita citaunica=conn.Table<Cita>().FirstOrDefault( ci=> ci.ID==ID);
  return citaunica;
  //return citaunica;
}

public IEnumerable<Cita>GetCitas() {
  var citasx=(from cit in conn.Table<Cita>() select cit);
  return citasx.ToList();
}
<ScrollView>
  <Grid>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Margin="10" x:Name="lbl_txt" Text="Datos de Orden" FontSize="25" />

      <ListView x:Name="ListCitaUnica" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid Padding="10">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />

                </Grid.RowDefinitions>


                <Label Text="Fecha" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="2" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding razon}" HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />


                <Label Text="Orden" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="3" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding descripcion}" HorizontalOptions="CenterAndExpand" Grid.Row="3" TextColor="Blue" Grid.Column="1" FontAttributes="Bold" />


                <Label Text="Itinerario" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="4" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding fecha}" HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />

                <Label Text="Medio " FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="5" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding hora}" HorizontalOptions="CenterAndExpand" Grid.Row="5" TextColor="Orange" Grid.Column="1" FontAttributes="Bold" />



              </Grid>
            </ViewCell>

          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>




    </Grid>

  </Grid>

</ScrollView>

public CitaInfo(int ID, string dt) {
  InitializeComponent();
  memberDatabase = new MemberDatabase();
  var citaunica = memberDatabase.CitaUnica(ID);
  ListCitaUnica.ItemsSource = citaunica;
  //DateTime dtx = DateTime.Parse(dt);


}
//Citas crud local
public string AddCita(Cita cita) {
  conn.Insert(cita);
  return "success :3 ";
}

public void DeleteCita(int ID) {
  conn.Delete<Cita>(ID);
}

public Cita CitaUnica(int ID) {
  Cita citaunica=conn.Table<Cita>().FirstOrDefault( ci=> ci.ID==ID);
  return citaunica;
  //return citaunica;
}

public IEnumerable<Cita>GetCitas() {
  var citasx=(from cit in conn.Table<Cita>() select cit);
  return citasx.ToList();
}
<ScrollView>
  <Grid>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Margin="10" x:Name="lbl_txt" Text="Datos de Orden" FontSize="25" />

      <ListView x:Name="ListCitaUnica" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid Padding="10">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />

                </Grid.RowDefinitions>


                <Label Text="Fecha" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="2" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding razon}" HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />


                <Label Text="Orden" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="3" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding descripcion}" HorizontalOptions="CenterAndExpand" Grid.Row="3" TextColor="Blue" Grid.Column="1" FontAttributes="Bold" />


                <Label Text="Itinerario" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="4" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding fecha}" HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />

                <Label Text="Medio " FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="5" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding hora}" HorizontalOptions="CenterAndExpand" Grid.Row="5" TextColor="Orange" Grid.Column="1" FontAttributes="Bold" />



              </Grid>
            </ViewCell>

          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>




    </Grid>

  </Grid>

</ScrollView>

 
public CitaInfo(int ID, string dt) {
  InitializeComponent();
  memberDatabase = new MemberDatabase();
  var citaunica = memberDatabase.CitaUnica(ID);
  ListCitaUnica.ItemsSource = citaunica;
  //DateTime dtx = DateTime.Parse(dt);


}
//Citas crud local
public string AddCita(Cita cita) {
  conn.Insert(cita);
  return "success :3 ";
}

public void DeleteCita(int ID) {
  conn.Delete<Cita>(ID);
}

public Cita CitaUnica(int ID) {
  Cita citaunica=conn.Table<Cita>().FirstOrDefault( ci=> ci.ID==ID);
  return citaunica;
  //return citaunica;
}

public IEnumerable<Cita>GetCitas() {
  var citasx=(from cit in conn.Table<Cita>() select cit);
  return citasx.ToList();
}
<ScrollView>
  <Grid>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Margin="10" x:Name="lbl_txt" Text="Datos de Orden" FontSize="25" />

      <ListView x:Name="ListCitaUnica" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid Padding="10">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />

                </Grid.RowDefinitions>


                <Label Text="Fecha" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="2" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding razon}" HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />


                <Label Text="Orden" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="3" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding descripcion}" HorizontalOptions="CenterAndExpand" Grid.Row="3" TextColor="Blue" Grid.Column="1" FontAttributes="Bold" />


                <Label Text="Itinerario" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="4" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding fecha}" HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />

                <Label Text="Medio " FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="5" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding hora}" HorizontalOptions="CenterAndExpand" Grid.Row="5" TextColor="Orange" Grid.Column="1" FontAttributes="Bold" />



              </Grid>
            </ViewCell>

          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>




    </Grid>

  </Grid>

</ScrollView>
Origen Enlace

SQLite SELECT query a ListView

Hola amigos estoy tratando de mostrar los datos de mi base SQLite a un listView de mi app en Xamarin Forms pero creo que estoy teniendo problemas no sé si con como llamo los datos o de como los estoy tratando de insertar a mi ListView ... esto es lo que tengo.

Este es mi error introducir la descripción de la imagen aquí

public CitaInfo(int ID, string dt) {
  InitializeComponent();
  memberDatabase = new MemberDatabase();
  var citaunica = memberDatabase.CitaUnica(ID);
  ListCitaUnica.ItemsSource = citaunica;
  //DateTime dtx = DateTime.Parse(dt);


}
//Citas crud local
public string AddCita(Cita cita) {
  conn.Insert(cita);
  return "success :3 ";
}

public void DeleteCita(int ID) {
  conn.Delete<Cita>(ID);
}

public Cita CitaUnica(int ID) {
  Cita citaunica=conn.Table<Cita>().FirstOrDefault( ci=> ci.ID==ID);
  return citaunica;
  //return citaunica;
}

public IEnumerable<Cita>GetCitas() {
  var citasx=(from cit in conn.Table<Cita>() select cit);
  return citasx.ToList();
}
<ScrollView>
  <Grid>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <Label Grid.Row="0" Margin="10" x:Name="lbl_txt" Text="Datos de Orden" FontSize="25" />

      <ListView x:Name="ListCitaUnica" Grid.Row="1" HorizontalOptions="FillAndExpand" HasUnevenRows="True">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <Grid Padding="10">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />

                </Grid.RowDefinitions>


                <Label Text="Fecha" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="2" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding razon}" HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />


                <Label Text="Orden" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="3" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding descripcion}" HorizontalOptions="CenterAndExpand" Grid.Row="3" TextColor="Blue" Grid.Column="1" FontAttributes="Bold" />


                <Label Text="Itinerario" FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="4" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding fecha}" HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="1" TextColor="Gray" FontAttributes="Bold" />

                <Label Text="Medio " FontSize="Medium" HorizontalOptions="StartAndExpand" Grid.Row="5" Grid.Column="0" FontAttributes="Bold" />
                <Label Text="{Binding hora}" HorizontalOptions="CenterAndExpand" Grid.Row="5" TextColor="Orange" Grid.Column="1" FontAttributes="Bold" />



              </Grid>
            </ViewCell>

          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>




    </Grid>

  </Grid>

</ScrollView>