Skip to Content
0
Former Member
Jan 12, 2011 at 09:53 PM

ReportDocument - Log on failed

572 Views

Hi all!

I have problem, when trying to connect to database, when report is being used 'SAP Business One' connection

type.

when it is 'OLE DB (ADO)' everything works fine.

i tried following code:


CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rDocClient = rDoc.ReportClientDocument;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnectInfo = new 

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfoClass();

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag logonAttribs = new 

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBagClass();
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag connectAttribs = new 

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBagClass();

logonAttribs.Add("Data Source", "mySQLServerName");
logonAttribs.Add("B1 License Server", "myLicServer:30000");
logonAttribs.Add("Company User Id", "manager");
logonAttribs.Add("Company User Password", "managerPass");
logonAttribs.Add("Database", "myDbName");
logonAttribs.Add("Locale Identifier", "1033");
logonAttribs.Add("PreQEDatabaseName", "myDbName");
logonAttribs.Add("PreQEServerName", "mySQLServerName");
logonAttribs.Add("Provider", "sqlncli10");
logonAttribs.Add("Security", false);
logonAttribs.Add("Server", "mySQLServerName");
logonAttribs.Add("Server Type", "MSSQL2008");
logonAttribs.Add("Database User ID", "sa");
logonAttribs.Add("Database Password", "saPass");
logonAttribs.Add("Trusted Connection", false);

connectAttribs.Add("Database DLL", "crdb_b1.dll");
connectAttribs.Add("QE_DatabaseName", "myDbName");
connectAttribs.Add("QE_DatabaseType", "SAP Business One");
connectAttribs.Add("QE_ServerDescription", "mySQLServerName");
connectAttribs.Add("SSO Enabled", false);
connectAttribs.Add("QE_SQLDB", true);
connectAttribs.Add("Server Name", "mySQLServerName");
connectAttribs.Add("Data Source", mySQLServerName");
connectAttribs.Add("QE_LogonProperties", logonAttribs);

newConnectInfo.Attributes = connectAttribs;
newConnectInfo.UserName = "sa";
newConnectInfo.Password = "saPass";
newConnectInfo.Kind = 

CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;

foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table table in 

rDocClient.DataDefController.Database.Tables)
    table.ConnectionInfo = newConnectInfo;

try
{
    rDocClient.VerifyDatabase();
}
catch { }

it does not work. it throws COM exception - Log On Failed.