I bring you another little problem that came up during my project (which is almost finished already). What this code is supposed to do is create a new "Artist" row, add it to the dataset (in its datatable) and update the database. Well, it's clear that something is missing. But I do not know what. I'm sorry for being so noob, I'm really not capable and it's been a good few hours already giving me face to face with this. I would appreciate any help.
The fields in the table are: Name (Varchar), Genre (Varchar), Labels (Varchar) and RealName (Varchar) and in the Artist class are the same, with String.
private void addToDataTable(DataTable d,Object objeto)
{
DataRow newRow;
if (d.TableName.Equals("artists"))
{
Artist dbArtist = (Artist)objeto;
newRow = ds.Tables["Artists"].NewRow();
newRow[0] = dbArtist.Name.ToString();
newRow[1] = dbArtist.Genre.ToString();
newRow[2]=dbArtist.Labels.ToString();
daArtists.Update(ds,"Artists");
}
else if (d.TableName.Equals("albums"))
{
newRow = ds.Tables["Albums"].NewRow();
}
else
{
//newRow = ds.Tables["Songs"].NewRow();
}
}