public DataSet MostView() { try { MyConnction.Open(); Mycommand = new OleDbCommand("MostView", MyConnction); Mycommand.CommandType = CommandType.StoredProcedure; ds = new DataSet(); adapter = new OleDbDataAdapter(Mycommand); adapter.Fill(ds, "UserHistory"); ImDb.WebService Db = new ImDb.WebService(); DataTable TableMovies = Db.GetMoviesName(); ds.Tables[0].Columns.Add(new DataColumn(("MovieName"), typeof(string))); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = TableMovies.Rows.Find(ds.Tables[0].Rows[i]["MovieID"]); ds.Tables[0].Rows[i]["MovieName"] = dr["MovieName"]; } return(ds); } catch (Exception err) { throw err; } finally { MyConnction.Close(); } }
private void AddMoviesNames(DataSet ds) //הוספת שמות הסרטים מ IMDB לטבלת הסטוריית סרטים למשתמש { ds.Tables["UserHistory"].Columns.Add(new DataColumn(("MovieName"), typeof(string))); ds.Tables["GroupHistory"].Columns.Add(new DataColumn(("MovieName"), typeof(string))); ImDb.WebService Db = new ImDb.WebService(); DataTable TableMovies = Db.GetMoviesName(); for (int i = 0; i < ds.Tables["UserHistory"].Rows.Count; i++) { DataRow dr = TableMovies.Rows.Find(ds.Tables["UserHistory"].Rows[i][1]); ds.Tables["UserHistory"].Rows[i]["MovieName"] = dr["MovieName"]; } for (int i = 0; i < ds.Tables["GroupHistory"].Rows.Count; i++) { DataRow dr = TableMovies.Rows.Find(ds.Tables["GroupHistory"].Rows[i]["MovieID"]); ds.Tables["GroupHistory"].Rows[i]["MovieName"] = dr["MovieName"]; } }