.net Studio Local Database

Posted by testerwpf on Stack Overflow See other posts from Stack Overflow or by testerwpf
Published on 2010-06-03T11:53:07Z Indexed on 2010/06/03 11:54 UTC
Read the original article Hit count: 320

Filed under:
|

Hello everyone,

i am designing a local database in .net with wpf as gui. I have added a new database, and added a new table. Through the TableAdapter i generated 2 statements ( 1 statement is a select stmt and 1 is a insert) , i insert name and firstname (id is auto generated). It works fine, i can display the table in a datagrid (wpf toolkit) and also add new items (name,firstname), when i close and start the application everything is fine (data in table is stored) BUT when i try to preview data in my database dataset (where my Adapters exist) , no data is displayed and then the table gets deleted.. why?

public partial class MainWindow : Window
{



    public MainWindow()
    {
        this.InitializeComponent();

        PlayerTableAdapter objPlayerTableAdapter = new PlayerTableAdapter();
        objDataGridResults.ItemsSource = objPlayerTableAdapter.GetDataAllPlayer();
    }
    //Button Event onClick
    private void m_voidAddPlayer(object sender, System.Windows.RoutedEventArgs e)
    {
        PlayerTableAdapter objPlayerTableAdapter = new PlayerTableAdapter();
        objPlayerTableAdapter.InsertQueryPlayer(objTextBoxPlayerName.Text.ToString(), objTextBoxPlayerFirstName.Text.ToString());
        objDataGridResults.ItemsSource = objPlayerTableAdapter.GetDataAllPlayer();
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about database