Hi,
I have this code:
string prname = Console.ReadLine(); SqlDataAdapter spjadap = new SqlDataAdapter("select * from spj", connString); spjadap.Fill(ds, "tab"); DataColumn parentcol = ds.Tables["j"].Columns["j#"]; DataColumn childcol = ds.Tables["tab"].Columns["j#"]; DataRelation dr = new DataRelation("tab_j", parentcol, childcol); ds.Relations.Add(dr); DataTable spjtable1 = ds.Tables["tab"]; DataRow[] rows = spjtable1.Select("Parent.jname = '" + prname + "'"); if (rows.Length == 0) { Console.WriteLine(something); } foreach (DataRow row in rows) { Console.WriteLine(@"for " + prname + " are: P# = " + row["p#"]); }
but instead of supposed, expected number of rows, it reurns double number of rows.
Can anybody help me please where is my mistake?
Thanks