如何在c#ViewModel中定义包含空格的sql输出的标头?

时间:2019-06-07 09:30:27

标签: c# .net sql-server database

我有一个存储过程stp_GetContractBillingDetailReportEquinoxByResultGrouping,它给出输出说(例如)

First Name Last Name Department ID是列标题的输出。我在ViewModel中将其定义为

public string FirstName{ get; set; }

public string LastName{ get; set; }

public string DeptID{ get; set; }

由于SQL输出列中的空格,该值为null我应该怎么做才能将sql header First Name的值分配给viewmodel对象FirstName而不更改数据库上的任何内容?

我尝试使用DisplayName

        [DisplayName("First Name")]
        public string FirstName{ get; set; }

        [DisplayName("Last Name")]
        public string LastName{ get; set; }

        [DisplayName("Department ID")]
        public string DeptID{ get; set; }



但是没用

0 个答案:

没有答案