I have a database which holds informations of students and their lectures. My aim is : Student will select lecture and when they press the button, their selected value will be added to database cell without deleting previous data.
For example:
This is the current database. When I click save button the cell deletes its current value and changes his value to the new one. But I want it to not delete the previous value.
For the proccess I am using this command :
protected void Kaydet_Click(object sender, EventArgs e)
{
OleDbConnection baglanti = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:/Users/ERKAN/Desktop/Final/Veritaban.mdb; Persist Security Info = False");
baglanti.Open();
OleDbCommand EKLE = new OleDbCommand("UPDATE Ogrenciler SET OgrenciDersler='" + DersList.SelectedItem.ToString() + "' WHERE OgrenciAd='" + Usernamelabel.Text+ "'", baglanti);
OleDbDataReader kayitekle = EKLE.ExecuteReader();
if (kayitekle.Read())
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Inserted Successfully')", true);
}
else
{
Response.Write("Kayıt başarısız");
}
}
I am Not sure what should I use instead of "Update" command. So I am looking for your helps. Also it would be better if I knew how to delete selected value from the database cell.
I am using ASP.NET webforms and as a database access database.