Hello I Have two databases generated from the same SQL code and two datasets created from this databases. I want to create one dataset from this two datasets, and i thought i could do this like this:
public void MergeGatunek()
{
DB1.DataSetGatunek.Tables[0].Merge(DB2.DataSetGatunek.Tables[0], true);
DataSetGatunek.Tables[0].Merge(DB1.DataSetGatunek.Tables[0], true);
//DataSetGatunek is the final DataSet
}
and this is the resoult: http://img697.imageshack.us/img697/3274/aaaub.jpg App is in Polish but it shouldnt be a problem :P
Every next new row just multiplies the results of previous adds. My goal is to show data from two databases in one DataGridView, and to add missing rows(if there are any).
Im using this metod for filling dataset, adding new rows etc.
public void SelectGatunek(string SQL)
{
try
{
Connection.Open();
DataAdapter = new SqlDataAdapter(SQL, Connection);
commandBuilder = new SqlCommandBuilder(DataAdapter);
DataSetGatunek.Clear();
DataAdapter.Fill(DataSetGatunek);
Connection.Close();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
SelectGatunek("Select * FROM t_gatunek");
SelectGatunek("INSERT INTO t_gatunek (gatunek) VALUES ('" + DG.GetGatunek + "')");