A Crystal report (CR) is created using NT Authentication (integrated security). Attempting to switch from NT Authentication to SQL Authentication at runtime has no effect when using Crystal Reports for Visual Studio .NET 2002.
Why does the report still use NT Authentication after switching to SQL Authentication?
This behavior occurs because Crystal Reports for
Visual Studio .NET 2002 does not support changing from
NT Authentication (integrated security) to SQL
Authentication at runtime.
This is a known issue with Crystal Reports for Visual
Studio .NET 2002 and has been tracked. The Track ID
To work around this issue, upgrade to either
Crystal Reports 9 Developer Edition or Crystal Reports
9 Advanced Edition as both editions support this
While it is possible to change from NT Authentication
to SQL Authentication at runtime, it is not possible to
change from SQL Authentication to NT Authentication at
runtime with either version.
The follow sample code (in both VB .NET and C# .NET)
demonstrates changing from NT Authentication to SQL
Authentication. This code assumes that the report has
been designed using NT Authentication.
Dim crReportDocument As CrystalReport1
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crtableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
Private Sub ChangeToSQLAuthentication()
' Create a new report
crReportDocument = New CrystalReport1()
crConnectionInfo = New ConnectionInfo()
' Set the connection information
crConnectionInfo.ServerName = "myServer"
crConnectionInfo.DatabaseName = "Pubs"
crConnectionInfo.UserID = "myUserID"
crConnectionInfo.Password = "myPassword"
' Obtain a reference to the tables
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
' Loop through all the tables and set the
' logon information
For Each crTable In crTables
crtableLogOnInfo = crTable.LogOnInfo
' This line is only necessary if you are
' changing the database location
' It removes the database and owner from
' the location property and sets the location
' equal to just the table name
".") + 1)
private void changeToSqlAuthentication()
// Create new report
crReportDocument = new CrystalReport1();
crConnectionInfo = new ConnectionInfo();
// Set Connection Information
// Obtain a reference to the tables
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
// Loop through all the tables and set the logon
crTable in crTables)
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
// This line is only necessary if you are changing
// the database location it removes the database
// and owner from the location property and
// sets the location equal to just the table name
DOTNET VS.NET TRUSTED CONNECTION VB.NET C# SECURITY PERMISSIONS Crystal Reports for Visual Studio Database Login NT Authentication and SQL Authentication , c2013558 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To