Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Crystal Enterprise in .Net?

Status
Not open for further replies.

mycrisco

Programmer
Dec 26, 2001
1
US
Hi,

I try to write some code to send querying to a Crystal Report
Enterprise,

For example:
1. How many peramaters a given report has?
2. What are the scheduled reports?

The sequence that I used as below:
1. Create a session manager.
2. Logon the server.
3. Retrieve an Information Store Object. // I can't get this
work.
4. Use the Information Store to perform query.

The attached is the code.

Thanks for any help,

-- Heng Ma (hma@ftintl.com)

using System;

using System.Text;

using System.Reflection;

using CrystalInfoStoreLib;

using CrystalEnterpriseLib;

using CrystalDecisions.Web;

using CrystalPluginMgrLib;

namespace CrystalES

{

/// <summary>

/// Summary description for Class1.

/// </summary>

public class Class1

{

public Class1()

{

}

public static void Main(string[] args)

{

CrystalEnterpriseLib.SessionMgr objSM; // ession Manager

CrystalEnterpriseLib.ISEnterpriseSession objES; // Session

CrystalInfoStoreLib.InfoStore objInfoStore; // Information Store

CrystalInfoStoreLib.ISInfoObjects objRS; // Information Objects

try

{

objSM = new SessionMgr();

objES = objSM.Logon(&quot;Administrator&quot;, &quot;&quot;, &quot;NBQDEV13&quot;,
&quot;secEnterprise&quot;);

// get an Information store

//objInfoStore = (InfoStore) objES.get_Service(&quot;&quot;,
&quot;InfoStore&quot;); // Failed

// execute a query

string strSelect = &quot;SELECT SI_ID FROM CI_INFOOBJECTS WHERE
SI_OBTYPE=18 AND SI_OWNERID=Administrator&quot;;

objRS = objInfoStore.Query(strSelect);

Console.WriteLine(objRS.Count);

}

catch (System.Exception e)

{

Console.WriteLine(e.Message);

}

}

}

}

 
Strange...

I've used the exact same syntax in various projects:

InfoStore = (InfoStore)Session.get_Service(&quot;&quot;, &quot;InfoStore&quot;);

and don't get any errors. What error are you seeing?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top