Ich habe eine Anwendung in VB.NET geschrieben. Es wurde vor einiger Zeit für einen Client auf 32-Bit-Architektur geschrieben. Die Datenbank ist MySQL 5.5. Die Berichte waren eingebaute Crystal Reports und die Datenbankverbindung war ODBC 32bit MySQL Connector über einen DSN.VB.NET Anwendung mit MySQL DSN-Verbindung für Crystal Reports fragt nach Anmeldeinformationen
Jetzt hat der Client alle Clients auf Windows 10 (64bit) aktualisiert. Die Desktopanwendung funktioniert gut mit demselben alten 32-Bit-Connector, aber wenn ein Bericht ausgeführt wird, wird nach einem Anmeldebildschirm gefragt. Leider funktioniert die Übergabe der Anmeldeinformationen zur Laufzeit nicht.
Der Code ist wie beigefügt. Ich habe alle Antworten durchgelesen, aber die Codes funktionieren nicht. Gibt es etwas, das mir fehlt? Kann jemand helfen? Ich weiß, das Problem ist ein altes, aber es ist eine laufende Anwendung für einige Jahre, und wir müssen nicht wirklich neu schreiben.
Code: (Called auf eine Schaltfläche Link)
Public Sub PrintAmcRemainderForIndus(ByVal componentId As Integer, ByVal AddressId As Integer)
'Dim cryRpt As New ReportDocument
Dim rPath As String = ""
Dim objForm As New frmViewReport
rPath = Application.StartupPath & "\Reports\rptAMCReminderForIndus.rpt"'
MessageBox.Show(rPath.Length & vbCrLf & rPath)
Dim crtableLogoninfos As New TableLogOnInfos()
Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
Dim cryRpt As New rptAMCReminderForIndus()
'If you are using ODBC, this should be the DSN name NOT the physical server name. If
'you are NOT using ODBC, this should be the
'physical server name
With crConnectionInfo
.ServerName = "Indus"
'If you are connecting to Oracle there is no
'DatabaseName. Use an empty string.
'For example, .DatabaseName = ""
.DatabaseName = "indus"
.UserID = "root"
.Password = "simsoft"
End With
'This code works for both user tables and stored
'procedures. Set the CrTables to the Tables collection
'of the report
CrTables = cryRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
Try
'cryRpt.Load(rPath)
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterValues.Clear()
crParameterDiscreteValue.Value = componentId
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("piCustomerId")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
crParameterDiscreteValue.Value = AddressId
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("piAddressId")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
objForm.rptViewer.ReportSource = cryRpt
objForm.Show()
Catch ex As Exception
MessageBox.Show(ex.Message & vbCrLf & ex.InnerException.Message)
End Try
End Sub