Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Crystal 9 OLE Control

57 views
Skip to first unread message

Scott Ewine

unread,
Jul 10, 2003, 9:07:35 AM7/10/03
to
I am trying to use the Crystal Report Viewer Control 9 as an OLE control in
one of my applications. I have designed some reports and want to be able to
change the database connectivity at runtime. I came across this code on the
CrystalDecisions web site. Can somebody help me convert this syntax to work
with PowerBuilder 8.0.2? I will be connecting to either Oracle or MSSQL
using OLE or ODBC.

Thanks in advance.

Scott Ewine


For an ODBC Connection, use the following code sample
--------------------------------------------------------------------

With External_Report.Database.Tables(1).ConnectionProperties
.Item("DSN") = "DSNname"
.Item("Database") = "DBName"
.Item("User ID") = "UID"
.Item("Password") = "PWD"
End With

For an OLE DB Connection, use the following code sample
----------------------------------------------------------------------

With Report.Database.Tables(1).ConnectionProperties
.Item("Provider") = "Provider Name"
.Item("Data source") = "Server Name"
.Item("Initial Catalog") = "Database Name"
.Item("User ID") = "UID"
.Item("Password") = "PWD"
End With

Jeff Nesler

unread,
Jul 10, 2003, 3:33:41 PM7/10/03
to
Scott:

Assuming you already have a reference to your report object, we'll call it
ole_rep, try this for ODBC:

oleobject ole_dbprop

ole_dbprop = create oleobject
ole_dbprop = ole_rep.database.tables[1].connectionproperties

ole_dbprop .Item("DSN").value = "YourDSNName"
ole_dbprop .Item("Database").value = "yourdatabasename"
ole_dbprop .Item("User ID").value = "userid"
ole_dbprop .Item("Password").value = "password"

Good Luck and HTH,
Jeff

"Scott Ewine" <s...@techassist.com> wrote in message
news:#WaydVuRDHA.238@forums-2-dub...

Scott Ewine

unread,
Jul 11, 2003, 8:17:22 AM7/11/03
to
This line worked:

ole_dbprop = ole_rep.database.tables[1].connectionproperties

So we are getting closer, but the rest does not work. How can I browse the
object to see what properties it has?

Scott Ewine


"Jeff Nesler" <please_don't_spam_jneslerATsheakleyDOTcom> wrote in message
news:%23ifoAwxRDHA.298@forums-2-dub...

Jeff Nesler

unread,
Jul 11, 2003, 9:36:35 AM7/11/03
to
Not the prettiest of solutions, but I just tried this as a test and it
worked for me:

string ls_nameids[]
int li_loop

ole_dbprop = ole_rep.database.tables[1].connectionproperties

ls_nameids = ole_dbprop.nameids
//nameids property returns an array containing the name of each connection
property in the collection.

for li_loop = 1 to upperbound(ls_nameids)
messagebox("property", ls_nameids[li_loop])
next

It displayed DSN, Database, User ID and Password in the messagebox. You
could do it in the debugger too by setting a breakpoint after the assignment
of ls_nameids and checking its value.

If you have it, check out the Crystal Developer help file,
CrystalDevHelp.chm. It has all these properties listed.

As for browsing the object, couldn't find a way to do it with the PB
Browser, but you can do it with the MS OLE/COM Object Viewer. If you don't
have it, go here to download it:

http://www.microsoft.com/com/resources/oleview.asp

Once installed, go the File > View TypeLib...
That will allow you to browse and find the craxdrt9.dll. Open it and it
should show you more than you ever wanted to know... heirarchy,
methods/properties of each object & more.

HTH,
Jeff


"Scott Ewine" <s...@techassist.com> wrote in message

news:OLE3Ke6RDHA.238@forums-2-dub...

0 new messages