There is code that I use to pass new data to Database (firebird):
FbConnection fbCon = new FbConnection(csb.ToString());
FbDataAdapter fbDAdapter = new FbDataAdapter("SELECT ID,name,score FROM players",fbCon);
FbCommandBuilder Cmd = new FbCommandBuilder(fbDAdapter);
DataSet DSet = new DataSet();
fbDAdapter.Fill(DSet);
DataRow rw = DSet.Tables[0].NewRow();
rw["ID"] = zID + 1;
rw["name"] = var;
rw["score"] = score;
DSet.Tables[0].Rows.Add(rw);
fbDAdapter.Update(DSet);
Maybe you can suggest better algorithm, or this is pretty good?
This way is OK, you are using a command builder that do a lot of work for, you can simply translate the above code into an insert command to execute directly on the database table :
In this way you avoid the command builder and loading the data into the Datatable, should be quite faster ...
This is lighter for database:
For a select: