private static DataTable GetTopUsers(DateTime date)
{
string format = " select posterid, poster,count(1) as postcount from {0} where postdatetime >= @startime group by posterid, poster ";
string str2 = " select posterid, poster,sum( postcount ) as sumpostcount from ( {0} ) a group by posterid, poster order by sumpostcount desc,posterid desc ";
DataTable postTableList = currentDataProvider.GetPostTableList();
string str3 = string.Empty;
for (int i = 1; i <= postTableList.Rows.Count; i++)
{
string str4 = BaseConfigs.GetTablePrefix.ToString() + "posts" + i.ToString();
str3 = str3 + " union all " + string.Format(format, str4);
}
str3 = str3.Substring(11);
DataTable table2 = new DataTable();
string commandText = string.Empty;
try
{
string str6 = BaseConfigs.GetDbType.ToLower();
if (str6 == null)
{
return table2;
}
if (!(str6 == "sqlserver"))
{
if (str6 != "mysql")
{
if (str6 != "access")
{
return table2;
}
goto Label_0163;
}
}
else
{
DbParameter parameter = DbHelper.MakeInParam("@startime", DbType.Currency, 8, DateTime.Parse(date.ToString("yyyy-MM-dd")));
commandText = string.Format(str2, str3);
return DbHelper.ExecuteDataset(1, commandText, new DbParameter[] { parameter }).Tables[0];
}
commandText = str3.Replace("@startime", "'" + date.ToString("yyyy-MM-dd") + "'");
commandText = string.Format(str2, commandText);
return DbHelper.ExecuteDataset(1,commandText).Tables[0];
Label_0163:
commandText = str3.Replace("@startime", "#" + date.ToString("yyyy-MM-dd") + "#");
commandText = string.Format(str2, commandText).Replace("sumpostcount desc", "sum( postcount ) desc");
table2 = DbHelper.ExecuteDataset(1, commandText).Tables[0];
}
catch (Exception exception)
{
throw new Exception(exception.Message + str3);
}
return table2;
}
我在编译的时候总是提示参数无效。请官方或高手给我一个具体的参考意见具体见下图。
附件:
error.jpg