please help me,
i have coding like :
try
{
SqlCeConnection connectionstring = new SqlCeConnection(@"Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\barang.sdf;Persist Security Info=False;"));
SqlCeDataAdapter da = new SqlCeDataAdapter("select * from barang", connectionstring);
DataSet ds = new DataSet();
da.Fill(ds, "barang");
MessageBox.Show("Connection successfull");
try
{
connectionstring.Open();
SqlCeCommand cmd = new SqlCeCommand("insert into barang(kdbarang) values(@kode)", connectionstring);
cmd.Parameters.Add("@kode", SqlDbType.NVarChar, 10);
cmd.Parameters["@kode"].Value = txtkode.Text;
cmd.ExecuteNonQuery();
MessageBox.Show("Records Inserted Successfully");
connectionstring.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
that code work well,no error...but data inserted not found in table..
can anyone help me??
sorry about my bad english...
thanks for advance
i have coding like :
try
{
SqlCeConnection connectionstring = new SqlCeConnection(@"Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\barang.sdf;Persist Security Info=False;"));
SqlCeDataAdapter da = new SqlCeDataAdapter("select * from barang", connectionstring);
DataSet ds = new DataSet();
da.Fill(ds, "barang");
MessageBox.Show("Connection successfull");
try
{
connectionstring.Open();
SqlCeCommand cmd = new SqlCeCommand("insert into barang(kdbarang) values(@kode)", connectionstring);
cmd.Parameters.Add("@kode", SqlDbType.NVarChar, 10);
cmd.Parameters["@kode"].Value = txtkode.Text;
cmd.ExecuteNonQuery();
MessageBox.Show("Records Inserted Successfully");
connectionstring.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
that code work well,no error...but data inserted not found in table..
can anyone help me??
sorry about my bad english...
thanks for advance