johh



  • hi ich bekomme einfach nicht die werte aus meine local datenbank in die listbox es wird mir nur der pfad angezeigt !? ich bedanke mich herzlich für eure hilfe.

    ----------------------------Main page
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using Microsoft.Phone.Controls;

    namespace Spielleiter_App_03
    {
    public partial class Erstellen_Uebersicht : PhoneApplicationPage
    {

    private const string strConnectionString = @"isostore:/StudentDB.sdf";

    public Erstellen_Uebersicht()
    {
    InitializeComponent();

    using (Hauptklasse context = new Hauptklasse(strConnectionString))
    {
    if (!context.DatabaseExists())
    {
    context.CreateDatabase();
    }
    }
    using (Hauptklasse DB = new Hauptklasse(strConnectionString))
    {
    var a = from b in DB.GetTable<Tabelle_Veranstaltung>() select b.Extra;
    //lstContactname.ItemsSource = a;
    List<Tabelle_Veranstaltung> dataSource = new List<Tabelle_Veranstaltung>();
    foreach (var x in a)
    {
    dataSource.Add(new Tabelle_Veranstaltung() { Extra = x });

    }

    this.myListBox.ItemsSource = dataSource;
    if (myListBox.Items.Count == 0)
    {
    myListBox.Visibility = Visibility.Collapsed;

    }
    else
    {
    myListBox.Visibility = Visibility.Visible;

    }

    }
    }

    private void myButton_Einmalige_Veranstaltung_Erstellen_Click(object sender, RoutedEventArgs e)
    {
    this.NavigationService.Navigate(new Uri("/Erstellen_Button_Einmalige_Veranstaltung.xaml", UriKind.Relative));
    }
    }
    }
    ----------------------------------second page
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using Microsoft.Phone.Controls;

    namespace Spielleiter_App_03
    {
    public partial class Erstellen_Button_Einmalige_Veranstaltung : PhoneApplicationPage
    {
    private const string strConnectionString = @"isostore:/StudentDB.sdf";
    public string parameterValue;
    public string Action;
    public string id;

    public Erstellen_Button_Einmalige_Veranstaltung()
    {
    InitializeComponent();

    using (Hauptklasse context = new Hauptklasse(strConnectionString))
    {
    if (!context.DatabaseExists())
    {
    context.CreateDatabase();
    }
    }
    }

    private void myButton_erstellen_Click(object sender, RoutedEventArgs e)
    {
    using (Hauptklasse DB = new Hauptklasse(strConnectionString))
    {
    Tabelle_Veranstaltung newVeranstaltung = new Tabelle_Veranstaltung
    {
    //Id = txtfname.Text.ToString() + " " + txtlastName.Text.ToString(),
    Extra = myTextBox_Name.Text.ToString() + " " + textBox1.Text.ToString(),
    Name = myTextBox_Name.Text.ToString(),
    Typ = textBox1.Text.ToString(),
    //Mobile = txtMobile.Text.ToString(),
    //Telephone = txtTelephone.Text.ToString(),
    //Email = txtEmail.Text.ToString()

    };
    DB.Veranstaltungen_H.InsertOnSubmit(newVeranstaltung);
    DB.SubmitChanges();

    }

    myTextBox_Name.Text = "";
    //txtlastName.Text = "";
    //txtMobile.Text = "";
    //txtTelephone.Text = "";
    //txtEmail.Text = "";
    this.NavigationService.Navigate(new Uri("/Erstellen_Uebersicht.xaml", UriKind.Relative));
    }
    }
    }
    ---------------------------[table]
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Data.Linq.Mapping;
    using System.Data.Linq;
    namespace Spielleiter_App_03
    {
    [Table]

    public class Tabelle_Veranstaltung
    {
    [Column(Storage = "Id", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
    public string Id
    {
    get;
    set;
    }
    [Column(CanBeNull = true)]
    public string Extra
    {
    get;
    set;
    }

    [Column(CanBeNull = true)]
    public string Name
    {
    get;
    set;
    }
    [Column(CanBeNull = true)]
    public string Typ
    {
    get;
    set;
    }

    }
    }
    ----------------------------------[class]
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Data.Linq;

    namespace Spielleiter_App_03
    {
    public class Hauptklasse : DataContext
    {
    public Hauptklasse(string connectionString) : base(connectionString)
    {
    }
    public Table<Tabelle_Veranstaltung> Veranstaltungen_H
    {
    get
    {
    return this.GetTable<Tabelle_Veranstaltung>();
    }
    }
    }
    }
    --------------------------------------



  • Hallo,

    kein vernünftiger Titel, Source-Code nicht in C#-Tags gepackt, keine Frage -> keine Antwort!



  • Kann mich nur anschließen. Man erkennt nichts ohne Color-Highlighting.
    Und der Titel ist jetzt auch nicht der allerbeste 😉
    Vielleicht formulierst du mal, was du möchtest und machst die Sache für uns leichter. Wir machen das ja aus Spaß an der Freude und werden nicht dafür bezahlt. 🙂


Anmelden zum Antworten