Skip to Content
Former Member
Mar 30, 2012 at 02:53 PM

Issue with MS SQL "sys" schema tables



we have an issue with one of our reports (CR 2008, .NET 2.0, C#). The report references a table called "Events", which is present in dbo.Events and on the SQL server. The report works fine in the designer, but when showing it in our own application (and changing the database connection infos to a different SQL server) the following error occurs (translated):

Crystal Report Windows Forms Viewer
This field name is unknown.

Details: errorKind

Error in file ""Events-Tabelle {1CAFDF4D-625B-4B1B-AFEB-CFF0450DD78E}.rpt"":

Error in record selection formula:

'{Events.cID} = {?Pm-Tasks.lEventID}'

This field name is unknown

Details: errorKind.

Apparently, it accesses the name in the wrong schema. How can we prevent that?
I use the following code to change the database connection to a new SQL server name (which works fine except in this case):

DbConnectionAttributes dbAttributes = new DbConnectionAttributes();

dbAttributes.Collection.Set("Auto Translate", "-1");

dbAttributes.Collection.Set("Connect Timeout", "15");

dbAttributes.Collection.Set("General Timeout", "0");

dbAttributes.Collection.Set("Integrated Security", false);

dbAttributes.Collection.Set("Locale Identifier", "5129");

dbAttributes.Collection.Set("OLE DB Services", "-5");

dbAttributes.Collection.Set("Provider", "SQLOLEDB");

dbAttributes.Collection.Set("Tag with column collation when possible", "0");

dbAttributes.Collection.Set("Use DSN Default Properties", false);

dbAttributes.Collection.Set("Use Encryption for Data", "0");

dbAttributes.Collection.Set("Data Source", serverName);

dbAttributes.Collection.Set("Initial Catalog", dbName);

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.DatabaseName = dbName;

connectionInfo.ServerName = serverName;

connectionInfo.UserID = "...";

connectionInfo.Password = "...";

connectionInfo.Attributes.Collection.Set("Database DLL", "crdb_ado.dll");

connectionInfo.Attributes.Collection.Set("QE_DatabaseName", dbName);

connectionInfo.Attributes.Collection.Set("QE_DatabaseType", "OLE DB (ADO)");

connectionInfo.Attributes.Collection.Set("QE_LogonProperties", dbAttributes);

connectionInfo.Attributes.Collection.Set("QE_ServerDescription", serverName);

connectionInfo.Attributes.Collection.Set("SSO Enabled", false);

connectionInfo.LogonProperties = dbAttributes.Collection;

table.LogOnInfo.ConnectionInfo = connectionInfo;