在VB.NET 2010 Plesae帮助中,在运行时获取Crystal报表与数据集连接中的错误 [英] Getting Error in Crystal report connection with dataset at runtime in VB.NET 2010 Plesae help

查看:111
本文介绍了在VB.NET 2010 Plesae帮助中,在运行时获取Crystal报表与数据集连接中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


HI那里

我一直试图用水晶报告连接我的数据,我的连接字符串工作正常。



我的问题是:我错过了一些奇怪的东西吗?任何代码行或任何应该使我的代码运行的单词。



我不确定这一行

HI there
I have been trying to connection my data with crystal report, My connection string is working fine.

My Question is : Am I missing something strange ? any line of code or any word which should make my code to run.

I am not sure about this line

rpt.DataSourceConnections.Item(0).SetLogon("admin", "")

管理员是否正确,或者这条线路是否正确?





我遇到错误运行水晶报告:

whether admin is correct, OR is this line is correct ?


I got an error when I run crystal report :

Failed to load database information.
Error in File temp_56590165-ed16-4da1-a673-53bddf012e93 {1BF41BB8-7C9E-4319-AAE9-A637C86EE90D}.rpt:
Failed to load database information.





请帮助我解决这个问题



点击此处查看参考图片:图片在Dropbox



这是我的代码:



PLEASE HELP ME TO SOLVED THIS TROUBLE

Click here for Reference Images : Images in Dropbox

Here is my code :

Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class Form5

    Dim rpt As New CrystalReport1

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

	createconn()'Create connection with DB
        Cmd.CommandText = "SELECT * FROM products"
        Cmd.Connection = Conn

        Dim adp As New OleDbDataAdapter
        adp.SelectCommand = Cmd
        Dim ds As New DataSet
        adp.Fill(ds, "products")

        Try
            rpt.DataSourceConnections.Item(0).SetConnection("", DBPath, False)
            rpt.DataSourceConnections.Item(0).SetLogon("admin", "")

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        rpt.SetDataSource(ds.Tables(0))' Getting Error at this stage
        cr.ReportSource = rpt
    End Sub
End Class

'Module for connection

Imports System.Data.OleDb

Module mdlconn
    Public Conn As New OleDbConnection
    Public Cmd As New OleDbCommand
    Public DBPath As String = Environment.CurrentDirectory & "\data\db.mdb;"
    Function createconn()
        Try

            If Conn.State = ConnectionState.Open Then Conn.Close()
            Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " _
            & Environment.CurrentDirectory & "\data\db.mdb;"
            Conn.Open()
            Return True
        Catch ex As Exception
            MsgBox("Unable to create connection." + vbCrLf + "Err : " + ex.Message, vbCritical)
            Return False
            End
        End Try
    End Function

End Module

推荐答案

检查过去的答案

无法在水晶报表查看器中加载数据库信息错误 [ ^ ]
Check this past answer
Failed to load database information error in crystal reports viewer[^]


这篇关于在VB.NET 2010 Plesae帮助中,在运行时获取Crystal报表与数据集连接中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆