错误:无法将类型\'System.DateTime\'隐式转换为\'System.Data.Common.DbParameter\'

问题描述

| 我的代码后面出现错误,我不确定下一步该怎么做 前端(asp.net)中的代码是
<asp:SqlDataSource ID=\"SqlDataSource2\" runat=\"server\" 
                ConnectionString=\"<%$ ConnectionStrings:LicensingConnectionString %>\" 



                SelectCommand=\"SELECT [School Name],[School City],[School State],LoginName,[Current Sales],Commission,[Pay Period start date],[Pay Period End date] FROM commissions WHERE ([Pay Period start date] &gt;= @Txt_selected_start_date) AND ([Pay Period End date] &lt;= @Txt_selected_end_date) AND (LoginName = \'[email protected]\') \" 
                OnSelecting=\"SqlDataSource2_Selecting\"
                >
                <SelectParameters>
                    <asp:parameter  
                        Name=\"Txt_selected_start_date\" Type=\"DateTime\" />
                    <asp:Parameter Name=\"Txt_selected_end_date\"  Type=\"DateTime\" />
                </SelectParameters>
            </asp:SqlDataSource>



<asp:PlaceHolder ID=\"pnlwithdates\" runat=\"server\" Visible=\"false\"> 
<div style=\"padding: 0 200px 0 200px\">
<br /><br />
Start Date: <asp:TextBox ID=\"TxtDatepicker_start\" runat=\"server\" Width = 125px >
      </asp:TextBox>

      &nbsp;&nbsp;End Date: <asp:TextBox ID=\"TxtDatepicker_end\" runat=\"server\" Width = 125px >
      </asp:TextBox>
      &nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID=\"Button_daterecords\" runat=\"server\"  Text=\"Show records\"  OnClick =\"SQLDisplay_Date_records\" /><br />
<br /><br />
而后端的代码是   受保护的空白   SqlDataSource2_Selecting(对象   发件人,   SqlDataSourceSelectingEventArgs e)           {               e.Command.Parameters [\“ @ username \”]。Value   = HttpContext.Current.User.Identity.Name;               e.Command.Parameters [\“ @ Txt_selected_start_date \”]   = DateTime.Parse(TxtDatepicker_start.Text);
    }
粗体代码是引发错误的行。 我该如何解决这个问题,任何输入都会很棒。 谢谢     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)