C# 如何显示两个不同表中的日期?

C# 如何显示两个不同表中的日期?,c#,mysql,visual-studio,dataview,C#,Mysql,Visual Studio,Dataview,在DataView中,我显示数据库中两个不同表中的两个日期。维护表中的维修日期和检查表中的检查表日期。 这两列在数据库表中都称为Date。问题是它只显示一个日期(检查表日期)。服务日期应为2015年6月14日 当我在MySql Workbench中运行SQL查询时,它会工作 SELECT checklistitem.*, cl.Date As ChecklistDate, m1.Date AS Date FROM checklistitem

在DataView中,我显示数据库中两个不同表中的两个日期。维护表中的维修日期和检查表中的检查表日期。 这两列在数据库表中都称为Date。问题是它只显示一个日期(检查表日期)。服务日期应为2015年6月14日

当我在MySql Workbench中运行SQL查询时,它会工作

 SELECT checklistitem.*,
          cl.Date As ChecklistDate,
          m1.Date AS Date
    FROM checklistitem
    LEFT JOIN maintenance m1 ON m1.CheckListID 
    LEFT JOIN Vehicle v ON m1.LinkedID = v.ID
    LEFT JOIN Trailer t ON m1.LinkedID = t.ID 
    LEFT JOIN GeneralSmall gs ON m1.TypeID = gs.ID
    LEFT JOIN fleetchecklist cl ON m1.ChecklistID = cl.ID
    WHERE m1.Company_ID = 129
其他日期代码如下:

    public DateTime Date { get; set; }
    public DateTime ChecklistDate { get; set; }

    protected override void FillObject(DataRow dr)
   {
                    if (dr["Date"] != DBNull.Value)
                        Date = Convert.ToDateTime(dr["Date"]);
                    if (dr["ChecklistDate"] != DBNull.Value)
                        Date = Convert.ToDateTime(dr["ChecklistDate"]);
   }



 <asp:BoundField DataField="Date" HeaderText="Service Date" SortExpression="Date"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField>
<asp:BoundField DataField="Date" HeaderText="Checklist Date" SortExpression="ChecklistDate"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField> 
public DateTime Date{get;set;}
public DateTime ChecklistDate{get;set;}
受保护的覆盖无效填充对象(DataRow dr)
{
if(dr[“Date”!=DBNull.Value)
日期=Convert.ToDateTime(dr[“Date”]);
if(dr[“ChecklistDate”]!=DBNull.Value)
日期=Convert.ToDateTime(dr[“ChecklistDate”]);
}

您正在将清单日期和服务日期分配给同一日期属性。这应该起作用:

public DateTime Date { get; set; }
public DateTime ChecklistDate { get; set; }

protected override void FillObject(DataRow dr)
{
    if (dr["Date"] != DBNull.Value)
        Date = Convert.ToDateTime(dr["Date"]);
    if (dr["ChecklistDate"] != DBNull.Value)
        ChecklistDate = Convert.ToDateTime(dr["ChecklistDate"]);
}


<asp:BoundField DataField="Date" HeaderText="Service Date" SortExpression="Date"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField>
<asp:BoundField DataField="ChecklistDate" HeaderText="Checklist Date" SortExpression="ChecklistDate"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField> 
public DateTime Date{get;set;}
public DateTime ChecklistDate{get;set;}
受保护的覆盖无效填充对象(DataRow dr)
{
if(dr[“Date”!=DBNull.Value)
日期=Convert.ToDateTime(dr[“Date”]);
if(dr[“ChecklistDate”]!=DBNull.Value)
ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”]);
}

您正在将清单日期和服务日期分配给同一日期属性。这应该起作用:

public DateTime Date { get; set; }
public DateTime ChecklistDate { get; set; }

protected override void FillObject(DataRow dr)
{
    if (dr["Date"] != DBNull.Value)
        Date = Convert.ToDateTime(dr["Date"]);
    if (dr["ChecklistDate"] != DBNull.Value)
        ChecklistDate = Convert.ToDateTime(dr["ChecklistDate"]);
}


<asp:BoundField DataField="Date" HeaderText="Service Date" SortExpression="Date"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField>
<asp:BoundField DataField="ChecklistDate" HeaderText="Checklist Date" SortExpression="ChecklistDate"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField> 
public DateTime Date{get;set;}
public DateTime ChecklistDate{get;set;}
受保护的覆盖无效填充对象(DataRow dr)
{
if(dr[“Date”!=DBNull.Value)
日期=Convert.ToDateTime(dr[“Date”]);
if(dr[“ChecklistDate”]!=DBNull.Value)
ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”]);
}

您正在将清单日期和服务日期分配给同一日期属性。这应该起作用:

public DateTime Date { get; set; }
public DateTime ChecklistDate { get; set; }

protected override void FillObject(DataRow dr)
{
    if (dr["Date"] != DBNull.Value)
        Date = Convert.ToDateTime(dr["Date"]);
    if (dr["ChecklistDate"] != DBNull.Value)
        ChecklistDate = Convert.ToDateTime(dr["ChecklistDate"]);
}


<asp:BoundField DataField="Date" HeaderText="Service Date" SortExpression="Date"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField>
<asp:BoundField DataField="ChecklistDate" HeaderText="Checklist Date" SortExpression="ChecklistDate"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField> 
public DateTime Date{get;set;}
public DateTime ChecklistDate{get;set;}
受保护的覆盖无效填充对象(DataRow dr)
{
if(dr[“Date”!=DBNull.Value)
日期=Convert.ToDateTime(dr[“Date”]);
if(dr[“ChecklistDate”]!=DBNull.Value)
ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”]);
}

您正在将清单日期和服务日期分配给同一日期属性。这应该起作用:

public DateTime Date { get; set; }
public DateTime ChecklistDate { get; set; }

protected override void FillObject(DataRow dr)
{
    if (dr["Date"] != DBNull.Value)
        Date = Convert.ToDateTime(dr["Date"]);
    if (dr["ChecklistDate"] != DBNull.Value)
        ChecklistDate = Convert.ToDateTime(dr["ChecklistDate"]);
}


<asp:BoundField DataField="Date" HeaderText="Service Date" SortExpression="Date"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField>
<asp:BoundField DataField="ChecklistDate" HeaderText="Checklist Date" SortExpression="ChecklistDate"  dataformatstring="{0:dd/MM/yyyy}"></asp:BoundField> 
public DateTime Date{get;set;}
public DateTime ChecklistDate{get;set;}
受保护的覆盖无效填充对象(DataRow dr)
{
if(dr[“Date”!=DBNull.Value)
日期=Convert.ToDateTime(dr[“Date”]);
if(dr[“ChecklistDate”]!=DBNull.Value)
ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”]);
}

Change 2nd
Date=Convert.ToDateTime(dr[“ChecklistDate”])
到`ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”])`@使两个日期都显示为2015年5月14日的artm更改第二次
Date=Convert.ToDateTime(dr[“ChecklistDate”])
到`ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”])`@使两个日期都显示为2015年5月14日的artm更改第二次
Date=Convert.ToDateTime(dr[“ChecklistDate”])
到`ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”])`@使两个日期都显示为2015年5月14日的artm更改第二次
Date=Convert.ToDateTime(dr[“ChecklistDate”])
到`ChecklistDate=Convert.ToDateTime(dr[“ChecklistDate”])`@导致两个日期均显示为2015年5月14日的artm