.net Studio Local Database
- by testerwpf
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();
}
}