Tomwo
asked on
CrystalReport in Visual Basic
I have a visual basic.net (2008) that will run Crystal Reports against a sql database. This works fine. I can not get Visual baisc to run a crystal report against a Visual FoxPro database / table. There is only one table linked to the report. The crystal report runs fine in the Crystal Report developer. All connections are made and the information is updated and correct. If I do not use the "refresh" in the VB code, the viewer will pull the last report run and display it. If the "refersh" is added (see the attached code), it pops up and ask for log in information. Everything that I have tried gives me the "Log On Failed" box. I am trying to supply the correct connection information in the code, but nothing works. I think foxpro does not require a uer id or passwork (?). Again the Crystal Report runs fine in the developer. My code is below. Thanks for any help
Imports CrystalDecisions.CrystalRe ports.Engi ne
Imports CrystalDecisions.Shared
Public Class Form1
' Added reference to CrystalDecisions.CrystalRe ports.Engi ne
' Added reference to CrystalDecisions.ReportSou rce
' Added reference to CrystalDecisions.Shared
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim icon As String
Dim strreportname As String = "g:\Ft9 reports - 2008\employee_list_test.rp t"
Dim ii As CrystalDecisions.Shared.Ta bleLogOnIn fo
Dim ci As CrystalDecisions.Shared.Co nnectionIn fo
Dim cr As New CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument
cr.Load(strreportname)
cr.Refresh()
CrystalReportViewer1.Repor tSource = cr
CrystalReportViewer1.Visib le = True
ii = cr.Database.Tables(0).LogO nInfo
ci = ii.ConnectionInfo
icon = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;Sou rceDB=f:\g ashouse\ma int.dbc;Ex clusive=No ;"
icon = icon & "NULL=NO;Collate=Machine;B ACKGROUNDF ETCH=NO;DE LETED=NO"
ci.ServerName = icon
ci.DatabaseName = "maint"
ci.UserID = ""
ci.Password = ""
ci.IntegratedSecurity = False
cr.Database.Tables(0).Appl yLogOnInfo (ii)
End Sub
Imports CrystalDecisions.CrystalRe
Imports CrystalDecisions.Shared
Public Class Form1
' Added reference to CrystalDecisions.CrystalRe
' Added reference to CrystalDecisions.ReportSou
' Added reference to CrystalDecisions.Shared
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim icon As String
Dim strreportname As String = "g:\Ft9 reports - 2008\employee_list_test.rp
Dim ii As CrystalDecisions.Shared.Ta
Dim ci As CrystalDecisions.Shared.Co
Dim cr As New CrystalDecisions.CrystalRe
cr.Load(strreportname)
cr.Refresh()
CrystalReportViewer1.Repor
CrystalReportViewer1.Visib
ii = cr.Database.Tables(0).LogO
ci = ii.ConnectionInfo
icon = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;Sou
icon = icon & "NULL=NO;Collate=Machine;B
ci.ServerName = icon
ci.DatabaseName = "maint"
ci.UserID = ""
ci.Password = ""
ci.IntegratedSecurity = False
cr.Database.Tables(0).Appl
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.