->sql语句
string mysql="select a.pkid,a.clientname,a.contractprice,a.qiantime,a.producttype,b.payid,b.paydays,b.nextpaydays,datediff(dd,paydays,nextpaydays) as ee,datediff(dd,paydays,getdate()) as ff from client as a left join clientpay as b on a.pkid=b.clientid and (b.paytoflag=1) where a.producttype=1 ";二>DataGrid
<asp:TemplateColumn HeaderText="当期付款">
<ItemTemplate>
<asp:Image ID="Image1" ImageUrl="gou.gif" Visible='<%#getDQvisible((DataBinder.Eval(Container.DataItem,"ee")),(DataBinder.Eval(Container.DataItem,"ff")))%>' runat=server/>
</ItemTemplate>
</asp:TemplateColumn>
三>后台方法
public bool getDQvisible(string day1,string day2)
{
if((Int32.Parse(day1))>(Int32.Parse(day2)))
{
return true;
}
else
return false;
}
四>错误提示
CS1502: 与“MWIT.Web.finance.khkuan.getDQvisible(string, string)”最匹配的重载方法具有一些无效参数
string mysql="select a.pkid,a.clientname,a.contractprice,a.qiantime,a.producttype,b.payid,b.paydays,b.nextpaydays,datediff(dd,paydays,nextpaydays) as ee,datediff(dd,paydays,getdate()) as ff from client as a left join clientpay as b on a.pkid=b.clientid and (b.paytoflag=1) where a.producttype=1 ";二>DataGrid
<asp:TemplateColumn HeaderText="当期付款">
<ItemTemplate>
<asp:Image ID="Image1" ImageUrl="gou.gif" Visible='<%#getDQvisible((DataBinder.Eval(Container.DataItem,"ee")),(DataBinder.Eval(Container.DataItem,"ff")))%>' runat=server/>
</ItemTemplate>
</asp:TemplateColumn>
三>后台方法
public bool getDQvisible(string day1,string day2)
{
if((Int32.Parse(day1))>(Int32.Parse(day2)))
{
return true;
}
else
return false;
}
四>错误提示
CS1502: 与“MWIT.Web.finance.khkuan.getDQvisible(string, string)”最匹配的重载方法具有一些无效参数
输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.FormatException: 输入字符串的格式不正确。源错误:
行 175: public bool getDQvisible(string day1,string day2)
行 176: {
行 177: if((Int32.Parse(day1))>(Int32.Parse(day1)))
行 178: {
行 179: return true;
总之是类型转换出错。
paydays 和nextpaydays在表中是datetime类型,ee,ff字段出现的是日期的差值