小编S.Q*_*UIN的帖子

相同视图中的c#2模型

我想在同一页面中获取2个视图.在我的HomeController中,我得到了我的数据库的信息.但是当我想在我的视图中显示信息时,我遇到了问题.

Homecontroler

 public ActionResult DetailEquipe()
    {
        List<EquipePersonnel> Viewep = new List<EquipePersonnel>();

        string path = HttpContext.Request.Url.AbsolutePath;
        //string id = path.Substring(path.LastIndexOf("/"));
        string id = System.IO.Path.GetFileName(path);
        ViewBag.ID = id;

        ViewBag.test = "testfail";
        List<Equipe> equipe = new List<Equipe>();
        List<Personnel> personnel = new List<Personnel>();
        try
        {
            using (var connection = new QC.SqlConnection(
         "Server = connection...."
         ))
            {
                connection.Open();
                Console.WriteLine("Connected successfully.");
                using (var command = new QC.SqlCommand())
                {
                    command.Connection = connection;
                    command.CommandType = DT.CommandType.Text;
                    command.CommandText = @"Select * from Equipe where Id='" + id + "'"; …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio

2
推荐指数
1
解决办法
109
查看次数

标签 统计

c# ×1

visual-studio ×1