Skip to Content
0
Former Member
Mar 02, 2011 at 03:26 PM

VS2008, VB2008, CR2008 - DB LogOn Question

26 Views

The code below is my DB logon routine and works just fine.

Note - The reports were created with the CR10 designer, not sure if it makes a difference regarding my question below.

Currently, when integrated security is not used, the application provides the db id and password.

My question: Is there a way to use the id and password that's entered in the ODBC (Informix DB) so that the application does not have to provide the id and password?

Thank You!

Private Sub LogonToDB _

(ByVal server As String, ByVal database As String, _

ByVal id As String, ByVal password As String, ByVal integrated_security As Boolean, _

ByRef myReport As CrystalDecisions.CrystalReports.Engine.ReportDocument)

Dim logonInfo As New TableLogOnInfo()

Dim table As Table

For Each table In myReport.Database.Tables

logonInfo = table.LogOnInfo

logonInfo.ConnectionInfo.ServerName = server

logonInfo.ConnectionInfo.DatabaseName = database

If integrated_security = True Then

'needed for sql server

logonInfo.ConnectionInfo.IntegratedSecurity = integrated_security

Else

logonInfo.ConnectionInfo.UserID = id

logonInfo.ConnectionInfo.Password = password

End If

table.ApplyLogOnInfo(logonInfo)

Next table

End Sub

Edited by: Richard Eadie on Mar 2, 2011 4:54 PM