我创建了一个 C# 程序并连接到 stimulsoft 以生成报告。
我使用以下代码将带有 2 个数据表的数据集发送到我的报告:
DataSet ds = new DataSet();
dtP.TableName = "dtP";
dtF.TableName = "dtF";
ds.Tables.Add(dtP);
ds.Tables.Add(dtF);
Report.RegData(ds);
Report.Show();
Run Code Online (Sandbox Code Playgroud)
和“报告”是stireport对象。
当我的报告页面显示时。我的报告是空的。
当仅将 1 个数据表作为数据集发送到我的报告时,效果很好。
解决:
将以下代码添加到我的 c# 程序可以解决我的问题:
objStiReport.Dictionary.Clear();
objStiReport.RegData(ds);
objStiReport.Dictionary.Synchronize();
Run Code Online (Sandbox Code Playgroud) 我在我的 Asp.Net 项目中使用 Telegram Bot Api 库(链接)(版本 13.0.1.0)。
我使用下代码将带有标题的图像发送到我的频道。
var sb = new StringBuilder();
sb.AppendLine("line1 ");
sb.AppendLine("line2 ");
sb.AppendLine("line3 ");
bot.SendPhotoAsync("@" + channel.Name, fileToSend, sb.ToString(), false, 0);
Run Code Online (Sandbox Code Playgroud)
但我的问题是我的换行符没有显示在输出中
如何解决这个问题并在输出中正确显示新行?
[解决了]
这是这个库的错误,升级到 13.2.0 问题解决了。
我在c#winforms上工作.我使用实体框架6.
在我的解决方案中,我有两个项目与A.BLL和A.DAL名称.(A.DAL在A.BLL参考文献中添加)
A.DAL项目我有方法:
public decimal Sum(Func<ml_doc, bool> predicate, Func<ml_doc, decimal> sumColumn)
{
try
{
using (dbEnteties = new Entities(Connection.CustomEntityConnection))
{
dbEnteties.ContextOptions.LazyLoadingEnabled = true;
var dbe = dbEnteties.ml_doc;
return dbe.Where(predicate).Sum(sumColumn);
}
}
catch (Exception exp)
{
throw exp;
}
}
Run Code Online (Sandbox Code Playgroud)
A.BLL项目我有方法(在A.DAL项目上使用Sum方法):
public decimal GetSum(long AccId, int? CntId, short BranchId, int BeginNumber)
{
try
{
using (dal = new DAL.DocDA())
{
// Sum method referenced from A.DAL project
return dal.Sum(
x =>
x.acc_id == AccId &&
x.cnt_id.Equals(CntId) &&
x.ml_doc_hdr.branch_id == BranchId && …Run Code Online (Sandbox Code Playgroud) 我想结合一些Linq表达式,所以我从下面的文章中提供帮助:
http://www.c-sharpcorner.com/uploadfile/04fe4a/predicate-combinators-in-linq/ 和 http://thanhhh.blogspot.com/2011/10/linq-to-entities-predicatebuilder-and.html
我有一个像这样的通用列表:
List<long> lstPA = new List<long>() { 2, 3 }; // the numbers can be added or removed
Run Code Online (Sandbox Code Playgroud)
如果我在代码下使用合并我的linq表达式,我从db获得正确的结果(记录)(我使用Entity Framework 4.0):
var exp1 = Predicate.FalseExpression<posts>();
exp1 = exp1.Or(x => x.post_author == 2);
exp1 = exp1.Or(x => x.post_author == 3);
Run Code Online (Sandbox Code Playgroud)
但是当我在foreach循环中组合linq表达式时这样:
var exp1 = Predicate.FalseExpression<posts>();
foreach (long id in lstPA)
{
exp1 = exp1.Or(x => x.post_author == id);
}
Run Code Online (Sandbox Code Playgroud)
我无法从db获得正确的结果(记录).
什么是两个代码块之间的差异以及如何解决这个问题(我必须使用foreach循环)?
我在c#project(winform)上工作.
在我的项目中,我对这样的数据表进行了排序:
dt.DefaultView.Sort = "a ASC, b ASC, c ASC";
Run Code Online (Sandbox Code Playgroud)
现在使用下面的表达式,我排序了一个通用列表,但结果与datatale结果不同.
var newList = oldList.OrderBy(x => x.a).OrderBy(x => x.b).OrderBy(x => x.c).ToList();
Run Code Online (Sandbox Code Playgroud)
如何将我的通用列表排序为数据表结果?(我希望在通用列表中有相同的数据表结果)
谢谢.