CrystalReport加载报告失败

我有一个使用Crystal Report 2008的Windows应用程序项目(C#和.NET 2.0)。但是在加载报告时有时会出现错误(似乎是偶然的)。 那个错误是: CrystalDecisions.Shared.CrystalReportsException: Load report failed. System.Runtime.InteropServices.COMException (0x8000020D): Unable to load report. at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() — End of inner exception stack trace — at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at SIA.DataTransfer.Forms.frmReport.GetStateReport(Int32 transferType) 请指导我。 我怎么解决这个问题?

WebClient非常慢

我有Webclient的问题。 这很慢。 从一个网站下载String需要大约3-5秒。 我没有任何网络问题。 这是我的Modifed WebClient。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; namespace StatusChecker { class WebClientEx: WebClient { public CookieContainer CookieContainer { get; private set; } public WebClientEx() { CookieContainer = new CookieContainer(); ServicePointManager.Expect100Continue = false; Encoding = System.Text.Encoding.UTF8; WebRequest.DefaultWebProxy = null; Proxy = null; } public void ClearCookies() { […]

.net中引用类型内的值类型的内存分配

我认为这是一个非常微不足道的问题,但我无法在网上得到明确答案。 我有一个包含值类型和引用类型的类。 考虑到类中的引用类型将在执行期间的某个时间实例化,如何为这样的类的每个成员分配内存? 如何为每个成员存储和访问指针? 还有哪种类型的内存结构,即堆栈或堆? 我知道这很多,如果我的代码中只使用了一个值类型的变量,那么它的值和所有其他细节(如类型等)都存储在堆栈中。 类似地,如果实例化引用类型,则在堆中创建实际对象,并且将指向该存储器位置的指针存储在堆栈中。 但是类(引用类型)中存在的值类型呢? 它们存储在哪里以及如何访问它们? 我在下面给出了这样一个类的例子。 参考这个课程的答案将非常有帮助。 public class Employee { public int EmpNo { get; set; } public string EmpName { get; set; } public BankAccDetails AccDetails { get; set; } } public class BankAccDetails { //Other properties here }

通过C#.net中的webservice将报表单元上传到jasperserver

我正在尝试通过来自C#.net的web服务将新的报告单元上传到jasperserver我已经成功上传/创建了报告单元,但是当我通过iReport资源库导航器点击报告时,它显示“No Attachment Present!” 在一个弹出框中。 下面是我发送给webservice的’createXML’: Bar Unit This is a test /reports/bar Bar Report This is a test true 以下是将“createXML”发送到Web服务的代码: JasperService.ManagementServiceService service = new JasperService.ManagementServiceService(); service.Credentials = new System.Net.NetworkCredential(“jasperadmin”, “jasperadmin”); service.PreAuthenticate = true; FileStream fs = new FileStream(@”C:\bar.jrxml”, FileMode.Open, FileAccess.Read); Microsoft.Web.Services2.Attachments.Attachment jrxmlAttachment = new Microsoft.Web.Services2.Attachments.Attachment(“text/xml”,fs); service.RequestSoapContext.Attachments.Add(jrxmlAttachment); string out = service.put(createXML); 来自webservice调用的响应给出了成功代码’0’,所以我有点难过。 我猜这个问题出在RequestSoapContext的文件附件中,因为在此之前一切都很好。 任何帮助将不胜感激!

表值可选参数

是否可以使用表值参数作为可选参数创建过程。 我尝试了以下代码: CREATE PROCEDURE SP @Table testteype = null READONLY AS …. 但我得到这个错误: Operand type clash: void type is incompatible with test type ps:我使用C#.Net的sql server

怎么才能得到linq的计数

我有一个名为带列的products的表: productid , productname, productprice categoryid 我的问题是我想根据产品名称和细节获得产品数量。 我想在DataGridView显示数据。 我如何知道单个产品名称的产品数量,如下所示? productid productname productavailable productprice ————————————————————————– 1 product A 2 products(product A) 100 2 product B 5 Products(product B) 200 像上面的表格一样,我必须在DataGridView显示。 我正在使用LINQ和C#,我的DbContext名称是tsgdbcontext 。

SQL语句的某些部分嵌套太深。 重写查询或将其分解为较小的查询

我在我的控制器中有动作调用以下方法: public IQueryable getcontactinfo(long[] id) { var organizationsiteids = from accountsitemapping in entities.AccountSiteMappings where id.Any(accountid => accountsitemapping.ACCOUNTID == accountid) select accountsitemapping.SITEID; var usersdepts = from userdept in entities.UserDepartments join deptdefinition in entities.DepartmentDefinitions on userdept.DEPTID equals deptdefinition.DEPTID where organizationsiteids.Any(accountid => deptdefinition.SITEID == accountid) select userdept; var contactsinfos = from userdept in usersdepts join contactinfo in entities.AaaUserContactInfoes […]

如何在WinForms中播放声音?

如何用C#在WinForms中播放声音?

C#Windows 8 Store(Metro,WinRT)Byte数组到BitmapImage

我正在开发一个将filter应用于图像的Windows 8 Metro应用程序。 我有一个网络版的应用程序,并希望移植它。 但是众所周知,WinRT没有.NET提供的所有好处:/ 目前我在字节数组上应用filter,我想保持这种方式,因为它超快! 因此,在过去的几天里,我一直在寻找将StorageFile转换为byte []然后将byte []转换为BitmapImage的方法。 到目前为止,我已经成功完成了第一个(StorageFile到byte [])。 我是这样做的: public async Task ImageFileToByteArray(StorageFile file) { IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream); PixelDataProvider pixelData = await decoder.GetPixelDataAsync(); return pixelData.DetachPixelData(); } 这段代码返回一个byte[] ,其中包含像素数据BGRA。 这是棘手的部分。 我无法成功将字节数组转换为BitmapImage。 我搜遍了所有的地方,很多人建议使用WriteableBitmap,但这对我没什么好处。 我还发现了一些应该起作用的代码片段……但它们没有。 我尝试过的解决方案之一是使用InMemoryRandomAccessStream,如下所示: public async Task ByteArrayToBitmapImage(Byte[] pixels) { var stream = new InMemoryRandomAccessStream(); await […]

服务已经存在(当它显然没有)

我正在尝试为我开发的Windows服务创建安装程序。 这个安装程序在某一点上有一个自定义用户界面,这是我第一次做这样的事情,所以我安装和卸载了几次服务,以确保安装程序中的所有内容都像我想要的那样。 现在我的问题是,当我尝试安装该服务时,它失败并显示错误1001:已存在指定的服务,但该服务在注册表,services.msc控制台或sc query无处列出。 任何人都可以给我一个发生了什么以及如何解决它的线索? 谢谢 编辑:谢谢你的回复。 我重新打开管理控制台并重新启动计算机,但仍然出现错误。 更改ProductCode和UpgradeCode也没有解决问题。 在注册表中也绝对没有引用该服务。