Witam szukalem na forum ale nie moglem znaleŹĆ tematu dokladnie takiego jaki mam problem.
Otoz
Problem polega na tym ze lacze sie z baza danych dodaje do bazy wszystko oki tylko nie wysietla mi
w dataGridView na biezaco tylko po nowym odpaleniu programu ;/
moze ktos cos doradzic bo juz siedze nad tym troche i nic mi do [glowa] nie przychodzi;/
private void button1_Click(object sender, EventArgs e)
{
private void button1_Click(object sender, EventArgs e)
{
SqlConnection sc = new SqlConnection(@"Data Source=(local)\SQLEXPRESS;AttachDbFilename=" +
@"C:\Documents and Settings\chudy\Moje dokumenty\Visual Studio 2008\Projects\Test1\Test1\1.mdf" +
";Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataAdapter sda = new SqlDataAdapter("SELECT * from Tabela", sc);
sc.Open();
string string_dodaj ="INSERT INTO Tabela (id,imie)"
+ "VALUES (" +
/* id */ textBox1.Text.ToString() + ",'" +
/* imie */ textBox2.Text.ToString() + "')";
SqlCommand objCmd = new SqlCommand(string_dodaj,sc);
DataSet tab = new DataSet();
sda.Fill(tab, "Tabela");
//odswiezanie
sda.Update(tab, "Tabela");
tab.Dispose();
tab = new DataSet();
sda.Fill(tab, "Tabela");
}