本文介绍了系统.运行. InteropServices ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么会这样吗.

此处错误:

did anybody got idea why this happen.

here the error:

Logon failed.
Details: ADO Error Code: 0x
Source: ADODB.Connection
Description: Provider cannot be found. It may not be properly installed.Error in File C:\WINDOWS\TEMP\CrystalReport1 {BE22427E-BE6D-4906-B64D-9735F7B7FED7}.rpt:
Unable to connect: incorrect log on parameters.





以下是我的代码:





Below is my code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo

        Dim crReportDocument As ReportDocument
        Dim crExportOptions As ExportOptions
        Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
        Dim Fname As String

        crReportDocument = New ReportDocument()

        crReportDocument.Load("D:\CMOS\VisitorPass\CrystalReport1.rpt")

        Dim mytablelog As Tables = crReportDocument.Database.Tables

        For Each myTable In mytablelog
            myLogin = myTable.LogOnInfo
            myLogin.ConnectionInfo.Password = "sa1"
            myLogin.ConnectionInfo.UserID = "sa1"
            myTable.ApplyLogOnInfo(myLogin)
        Next

        Fname = "c:\windows\temp\" & Session.SessionID.ToString & ".pdf"
        crDiskFileDestinationOptions = New DiskFileDestinationOptions()
        crDiskFileDestinationOptions.DiskFileName = Fname
        crExportOptions = crReportDocument.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With

        crReportDocument.Export()

        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.WriteFile(Fname)
        Response.Flush()
        Response.Close()

        System.IO.File.Delete(Fname)
        Me.CrystalReportViewer1.ReportSource = crReportDocument
    End Sub

推荐答案

Unable to connect: incorrect log on parameters.


检查您的用户名和密码.


Check your username and password.



这篇关于系统.运行. InteropServices ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 19:00