c# jak zapisać dane w tabeli?
Gdy nacisnę przycisk "zapisz" to po wyjściu z Aplikacji nie pamięta tego co wpisałem.
Robię z poradnika Microsoft
Bazę danych dodałem przez Projekt>dodaj skadnik
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApp12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: Ten wiersz kodu wczytuje dane do tabeli 'baza69DataSet.Oprogramowanie' . Możesz go przenieść lub usunąć.
this.oprogramowanieTableAdapter.Update(this.baza69DataSet.Oprogramowanie);
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void bindingNavigator1_RefreshItems(object sender, EventArgs e)
{
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
this.Validate();
this.oprogramowanieBindingSource.EndEdit();
this.oprogramowanieTableAdapter.Update(this.baza69DataSet.Oprogramowanie);
MessageBox.Show("Update successful");
}
catch (System.Exception ex)
{
MessageBox.Show("Update failerd");
}
}
private void oprogramowanieBindingSource_CurrentChanged(object sender, EventArgs e)
{
}
}
}
Po wyjściu nie pamięta danych:
Tu jeszcze zaznaczyłem `kopiuj jeśli nowszy bo to niby miało rozwiązać ten problem'