I am trying to write an interface for users to view Crystal Report and the users no need to enter database login user name and password.The report gets data from Visual FoxPro and Microsoft SQL Server via ODBC.
I use ReportDocument to load the report. use this fragment to put username password in IConnectionInfo
Dim myDataSourceConnections As DataSourceConnections = northwindCustomersReport.DataSourceConnections
For Each myConnectInfo As IConnectionInfo In myDataSourceConnections
If myConnectInfo.ServerName = "database" Then 'SQL Server
myConnectInfo.SetLogon("username", "password")
ElseIf myConnectInfo.ServerName = "database2" Then 'Visual FoxPro
myConnectInfo.SetConnection("database2", "", "", "")
End If
Next
When I run the program, it keeps asking the username and password for VFP but VFP connection doesn't need any. If I just click "OK", and it said failed to login.
Please advise.
Thanks.