Witam, mam problem z dodaniem wiersza do bazy danych. Otóż niby wszystko ok, w programie pokazuje że ładnie dodano jednak w bazie on się faktycznie nie znajduje.
string dbfile = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\bazafirm.sdf";
SqlCeConnection connection = new SqlCeConnection("datasource=" + dbfile);
// Read all rows from the table test_table into a dataset (note, the adapter automatically opens the connection)
using (var adapter = new SqlCeDataAdapter("SELECT * FROM baza", connection))
using (new SqlCeCommandBuilder(adapter))
{
// Read all rows from the table test_table into a dataset (note, the adapter automatically opens the connection)
DataSet data = new DataSet();
adapter.Fill(data, "baza");
DataTable companyTable = data.Tables[0];
DataRow row = companyTable.NewRow();
row["id"] = t.Rows.Count + 1;
row["nazwa"] = nazwaBox1.Text;
row["kod"] = kodBox2.Text;
row["miasto"] = miejscowoscBox3.Text;
row["ulica"] = ulicaBox4.Text;
row["tel"] = telBox6.Text;
row["fax"] = faxBox7.Text;
row["email"] = mailBox5.Text;
row["branza"] = branzaBox1.Text;
row["wojewodztwo"] = wojewBox2.SelectedItem.ToString();
data.Tables[0].Rows.Add(row);
// Save data back to the databasefile
adapter.Update(data, "baza");
connection.Close();
this.Close();
}
Dziękuję za pomoc.