7 Replies - 3413 Views - Last Post: 09 May 2012 - 06:29 AM Rate Topic: -----

#1 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Reporting from SQL Server

Posted 05 May 2012 - 12:32 AM

It's quite rare that I post questions of my own, but I've found myself in a position where I'm unsure of the best way forward.

I've got to add some custom reports to a current VB6 application with the data coming from SQL Server.

The reports need to have logos, grids as well as the required data and they may span multiple pages.

Other than basic text reports, I've never had a need to do reporting in VB6 before and I'm looking for some advice.

I've been googling and looking through the forums here and it seems the DataReport is what most seem to use (please correct me if I'm wrong), but from what I've found, I'm not sure it suitable.

The following are my usage requirements:

  • Report is purely for printing purposes. The application will be running on a server and will just print a report at the end of a process.
  • The database is SQL Server. It's location will change from my dev machine once at the customers.
  • Report would be better a template external to the program.
  • Would be useful if the report output could be saved to the server (or printed as PDF).



My findings related to the above are as follows:

  • Datareport seems to require the report to be viewed before printing.
  • You need to set up a connection in advance. I didn't see an example using a dynamic connection.
  • Customers have a habit of changing their mind. It would be useful if the report could be external. It seems datareports are compiled into the application.
  • Similarly to the first point, I couldn't see an example without user intervention.



I'm just looking for some pointers in the right direction.

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Reporting from SQL Server

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Reporting from SQL Server

Posted 05 May 2012 - 09:29 AM

Crystal Reports is pretty popular, has a richer feature set than the DataReport thing, and later versions are backward compatible with VB6 AFAIK. I've personally used Crystal Reports 8.0 with VB6 (the version that ships with VB5 and VB6 is 4.1) and had no complaints. You might also investigate some of the newer SQL Server reporting capabilities, although I'm no expert in those.

I don't think much of the DataReport thing. The version with VB6 is basically 1.0, and they never really did anything with it after that.

This post has been edited by BobRodes: 05 May 2012 - 09:31 AM

Was This Post Helpful? 1
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: Reporting from SQL Server

Posted 06 May 2012 - 02:18 AM

Thanks Bob.

I'm fairly sure we have crystal reports somewhere in the office, so I guess that's something I'll have a look into.

I'm unsure whether reporting is part of the default installation of SQL Server, or whether it even comes with SQL Express (which might be used in this instance), which is why I didn't even consider going down that route.
Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Reporting from SQL Server

Posted 07 May 2012 - 06:29 AM

http://msdn.microsof...y/ms365166.aspx
http://www.microsoft...ls.aspx?id=1842
:P

This post has been edited by BobRodes: 07 May 2012 - 06:32 AM

Was This Post Helpful? 0
  • +
  • -

#5 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: Reporting from SQL Server

Posted 07 May 2012 - 07:23 AM

Thanks Bob, wish I'd seen this before now.

I've just spent most of the day at work on a holiday trying to get our version of CR(8.01) working with VB6 against SQL 2008 on Win7x64 and it just doesn't want to play ball at all.

I noticed that VS2008 comes with CR built in, so I was contemplating seeing if I could write something in VS2008, that could be called from VB6 to produce the reports.

I'll have a look into the reporting services on SQL and see what it entails.

[EDIT] I've had a quick look into the SQL reporting and I can't seem to find anything that suggests I can trigger a report to be printed directly without previewing it first through a browser or other application. It appears more suited for users that need to view reports dynamically and print if required, whereas I need to be able to print on demand from my application with no user intervention.

This post has been edited by maj3091: 07 May 2012 - 07:35 AM

Was This Post Helpful? 0
  • +
  • -

#6 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Reporting from SQL Server

Posted 07 May 2012 - 10:42 AM

Looks like the mechanism to store canned reports is the RDL file, which is nothing more than an XML description of the report. Googling "SQL RDL" and "SQL RDL VB6" reveals a fair amount of information on the subject.

If you want to call .Net stuff from VB6, check the registry for classes beginning with "System". Those classes are directly accessible via the COM mechanism.
Was This Post Helpful? 0
  • +
  • -

#7 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: Reporting from SQL Server

Posted 08 May 2012 - 11:40 PM

Just to close this thread, I dropped the CR and SQL reporting ideas and went for PDF generation and my own SQL routines for population which works quite well.
Was This Post Helpful? 0
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Reporting from SQL Server

Posted 09 May 2012 - 06:29 AM

Good for you. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1