2016-03-25 6 views
0

私はVB.NETで書かれたアプリケーションを持っています。 これは、32ビットアーキテクチャーでクライアントのために書かれたことがあります。 データベースはMySQL 5.5です。 レポートはビルドされたCrystalレポートであり、データベース接続はDSNを介したODBC 32ビットMySQLコネクタでした。Crystal Reports用のMySQLのVB.NETアプリケーションでCrystal Reportsのログオン情報を尋ねる

クライアントはすべてのクライアントをWindows 10(64ビット)にアップグレードしました。 デスクトップアプリケーションは同じ古い32ビットコネクタでうまく動作しますが、レポートを実行するとログオン画面が表示されます。残念ながら、実行時にログイン資格情報を渡すことはできません。

コードは添付されています。私はすべての答えを閲覧しましたが、コードは機能しません。私が紛失しているものはありますか?誰も助けることができますか? 私は問題が古いものだと知っていますが、それは何年も実行中のアプリケーションであり、実際に書き直す必要はありません。

コード:(ボタンのリンク上で呼び出さ)

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 

答えて

0

私は間違って何かがここにあることを言う:

'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" 

あなたは、あなたがODBCの名前を提供しているかわかりませんホスト名?

はこちらをご覧:

http://www.tek-tips.com/faqs.cfm?fid=4870

、ここで:

How to set database login infos (connection info) for crystal report vb.net?