Skip to Content
0
Former Member
Nov 21, 2007 at 02:53 AM

Dll integration with Viewer : Setting the SQL server login parameters

50 Views

Let's see if I can figure this out enough to ask an intelligent question.

I'm using Microsoft SQL 2005.

I bought a library to use the report viewer in the obscure dialect I program in, "Clarion." It uses the crpe32.dll to display and print reports. My idea here is to use Crystal instead of Clarion's brain damaged reporting system and ship the rpt files to the clients so they can run the reports on their data. I can successfully open a report and display/print/export from my Clarion program, but only as long as I'm querying my database. Of course, the customers will want to see their data, not mine.

Whenever I try to set the login information to another server/database/user/password I get error boxes about can't find the table. The "other" database has the same table names, that's how my silly program finds its data.

Let's see. I open and init the report, then do PEDiscardSavedData so it will fetch data from the server, then PESetNthTableLogOnInfo. Next, it loops through the sections using PEGetSectionCode to see if there are sub reports. If there are, on each sub report it does PEGetSubreportInfo, PEOpenSubreport and PSESetNthTableLogOnInfo...

Then it sets any function values...

And then:

PEShowPrintControls,

PEOutputToWindow,

PESetWindowOptions,

PEStartPrintJob

PEGetWindowHandle

And poof! The report appears magically, as long as the server/database/user/password were the same as I used when I initially designed the report. I have tested to see that it actually fetches data from the db.

Maybe I should design the reports ODBC and require a fixed data source name that attatches to whatever db the client is using? I think I've been trying OLE DB.

Confused, puzzled, and about half a bubble off level.