public static DataTable GetLinksByPage(int siteId, int pageId) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("ItemID", typeof(int)); dataTable.Columns.Add("ModuleID", typeof(int)); dataTable.Columns.Add("ModuleTitle", typeof(string)); dataTable.Columns.Add("Title", typeof(string)); dataTable.Columns.Add("Description", typeof(string)); dataTable.Columns.Add("ViewRoles", typeof(string)); dataTable.Columns.Add("CreatedDate", typeof(DateTime)); using (IDataReader reader = DBLinks.GetLinksByPage(siteId, pageId)) { while (reader.Read()) { DataRow row = dataTable.NewRow(); row["ItemID"] = reader["ItemID"]; row["ModuleID"] = reader["ModuleID"]; row["ModuleTitle"] = reader["ModuleTitle"]; row["Title"] = reader["Title"]; row["Description"] = reader["Description"]; row["ViewRoles"] = reader["ViewRoles"]; row["CreatedDate"] = Convert.ToDateTime(reader["CreatedDate"]); dataTable.Rows.Add(row); } } return(dataTable); }