日期:2014-05-17  浏览次数:20780 次

非静态字段引用
private const string sql_select2 = "select [year] as 年,[month] as 月,[money_plan] as 计划金额 from month_money where year='" + b1 + "'and month='" + b2 + "'";

走过路过的同学们帮忙看看,这代码要怎么改。

------解决方案--------------------
const是常量  个人感觉你这样写的结果貌似没多大用
你可以试试private const string sql_select2 = "select [year] as 年,[month] as 月,[money_plan] as 计划金额 from month_money where year='{0}'and month='{1}'";
用的时候string.format(sql_select2,b1,b2);
你既然用了常量 就是不能修改 还在后面加变量就没有意义了