0
我需要将数据传递给我的视图。
我的ActionResult是这个我需要从控制器传递什么类型的数据来查看?
public ActionResult Index()
{
SiteMapData sp = new SiteMapData();
ViewData["folders"] = sp.GetFolders();
return View();
}
sp.GetFolders返回一个DataView
internal DataView GetFolders()
{
SqlCommand cmd = new SqlCommand("usp_PGF_Select");
cmd.CommandType = CommandType.StoredProcedure;
SqlConnection myConnection = Util.GetConnection();
cmd.Connection = myConnection;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataView dView = ds.Tables[0].DefaultView;
return dView;
}
我需要怎么走了过来在我看来,数据。
我尝试这一点,但它不是工作
@foreach (var c in (System.Data.DataView)ViewData["folders"])
{
<p>@c.SMF_Name</p>
}
也许我需要通过另一种类型的数据?
我知道,但对于这个项目,我需要使用连接到一个网站,将继续工作的mssql 2000分贝。我只是开发后台。 – eyalb 2011-05-02 09:00:18