Hi There, Well, first of all sorry about this question it must be pretty straight forward for you guys but I'm struggling myself on it, and I need to make it work :( Well I'm trying t o use DataSet on my application
and when I render it I got:
The type 'System.Data.DataSet' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data
in my application System.Data is already being referenced from C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
and I'm using on my using clauses as well
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
This DataSet is a response from a Webservice So any Ideas on how to fix this problem?
PS. I don't know if it helps, but I'm using nHaml to render my view
Thanks a lot
UPDATE:
The only solution I found for now was to instead passing a DataSet to the view converter the DataSet to a
<List<List<String>>
and pass a loop through the entire DataSet like this
List<List<String>> myList = new List<List<String>>();
foreach (DataRow row in dsTrades.Tables[0].Rows)
{
List<String> myListColumns = new List<String>();
for (var index = 0; index < dsTrades.Tables[0].Columns.Count; index ++)
{
myListColumns.Add(row[index].ToString());
}
myList.Add(myListColumns);
}
// THIS SHOULD BE THE DATASET AND NOW
// IT'S CONVERTED TO A LIST WITH STRINGS LIST INSIDE
viewModel.Trades = myList;
return View(viewModel);
Actually this is completely crazy ins't it?
All this job could be easily done into the view if using DataSet directly I hope anyone can help me with a more simplistic way to do it
Thank you :)
UPDATE (SOLUTION)
Simon's answer was really effective and it worked on the first try after adding namespaces for System.Data and System.Xml but at the same time, Josh's answer present a very nice and cool way to work with DataSets, which on my opinion works much better and I think I'll go for it now.
Thanks for you help