我已经尝试了一段时间了,我真的不明白.我发现错误"不能隐式地将类型'void'转换为'string'"我尝试了多种字符串变体,int,nothing,void,public,static和nope我真的不对.
我想通过我的DAL和BLL从我的db中获取一个值,我的代码看起来像这样.
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Repeater1.DataSource = BLL.getGames();
Repeater1.DataBind();
var culture = CultureInfo.GetCultureInfo("sv-SE");
var dateTimeInfo = DateTimeFormatInfo.GetInstance(culture);
var dateTime = DateTime.Today;
int weekNumber = culture.Calendar.GetWeekOfYear(dateTime, dateTimeInfo.CalendarWeekRule, dateTimeInfo.FirstDayOfWeek);
string mroundY = dateTime.Year.ToString();
string mroundW = weekNumber.ToString();
string mrounddate = mroundY + mroundW;
string mround = BLL.getMroundGames(mrounddate); <-- Here's the error
}
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
}
}
Run Code Online (Sandbox Code Playgroud)
我的BLL看起来像这样;
public class BLL
{
public static void getMroundGames(string mrounddate) …Run Code Online (Sandbox Code Playgroud)