2

我需要你的帮助。

我正在为商店程序编写代码,我正在使用 vb.net 2008 和 Crystal Report 版本 10.5.37xxxx

问题是当我试图在客户端计算机上安装我的程序时,一切正常,但在我的 Crystal Report 中却不行。它总是要求数据库登录,我没有编写我的程序来要求数据库登录。

我只是用这样的简单代码编写了它:

Public Class Form16

    Private Sub Form16_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim view As New CrystalReport4
        view.SetParameterValue("p_1", Form5.no_faktur_tb_immanuel)
        CrystalReportViewer1.ReportSource = view
    End Sub

End Class

谁能帮我这个?

4

4 回答 4

1

确保您的报告DataSource Provider设置为Microsoft OLE DB provider for SQL Server而不是SQL Server Native Client 10.0

于 2013-01-22T13:54:50.500 回答
1

您应该能够手动编写登录凭据。

Public Class Form16

    Private Sub Form16_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim view As New CrystalReport4
        Dim user as string = "Username"
        Dim pwd as string = "Password"

        view.SetDatabaseLogon(user, pwd)
        view.SetParameterValue("p_1", Form5.no_faktur_tb_immanuel)
        CrystalReportViewer1.ReportSource = view

    End Sub

End Class
于 2013-01-22T13:57:42.580 回答
0

尝试打开字段资源管理器--->数据库字段--->右键单击-->当前数据源--->报告连接----->报告 ----->属性---->设置属性作为 - -

数据源:.\Databasename.accdb

查看器表单上的代码加载为

Dim cryRpt 作为新的 ReportDocument

    Dim Report1 As New rptItemWise

    Dim strServerName As String
    strServerName = Application.StartupPath
rptItemWise.SetDatabaseLogon("admin", "", strServerName, "dastabasename.accdb", True)



    cryRpt.Load(Application.StartupPath + "\rptItemWise.rpt")

还更改与数据源相同的报告连接我认为代码对你有用....

于 2014-12-09T07:23:06.957 回答
0

这对你有用!

C#代码:


ConnectionInfo boconnectioninfo = new ConnectionInfo ();

boconnectioninfo.ServerName= "D-2818-w2k";

boconnectioninfo.DatabaseName ="NW";

boconnectioninfo.UserID ="sa";

boconnectioninfo.Password ="sa";

CrystalReportViewer1 .ReportSource = Server.MapPath("CrystalReport1.rpt");

TableLogOnInfos botableInfo= CrystalReportViewer1 .LogOnInfo;

            foreach (TableLogOnInfo obj2 in botableInfo)


            {
                obj2.ConnectionInfo =boconnectioninfo;

            }

VB.net 代码:



    Dim boconnectioninfo As New ConnectionInfo
        boconnectioninfo.ServerName = "sa"
        boconnectioninfo.DatabaseName = "sa"
        boconnectioninfo.UserID = "sa"
        boconnectioninfo.Password = "sa"
        Me.rptViewer.ReportSource = _ReportPath
        Me.rptViewer.SelectionFormula = _SelectionFormula
        If Not _ParameterFields Is Nothing Then
            Me.rptViewer.ParameterFieldInfo = _ParameterFields
        End If
        Dim a As TableLogOnInfos = Me.rptViewer.LogOnInfo





        ' Iterate through the list.
        For Each aa As TableLogOnInfo In a
            aa.ConnectionInfo = boconnectioninfo
        Next

        Me.Cursor = Cursors.Default
        rptViewer.Refresh()
于 2019-12-27T10:40:56.600 回答