Web Development »
ASP.NET »
General
Intermediate
Microsoft SQL Database Documentor
By gogglin
A Microsoft SQL database documentor, using Crystal Reports
|
VB, SQL, C# 1.0, C#, Windows, .NET, .NET 1.1, .NET 2.0, ASP.NET, VS.NET2003, VS, DBA, Dev
Posted: 17 Aug 2006
Updated: 17 Aug 2006
Views: 16,066
|
|
|
|
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article

Introduction
This project uses Crystal Reports to generate a database
schema listing on a Microsoft SQL database. The listing includes extended
column information including the column descriptions. This project requires
Visual Studio 2003 or 2005, .NET Framework 1.1, and the Crystal Reports for
Visual Studio component.
The generated report lists column names, data types, size, description, etc.
Primary key columns are preceded by an asterisk. Columns names are italicized
when the column is allowed to be NULL in the table.
Background
One day I set out to document a database that I had been studying.
Using the Table Designer in Enterprise Manager, I began entering descriptions
of the columns of each table.
Later on I discovered that there is no way to print out the column descriptions
using EM. I did a little research and discovered how to get the descriptions
out of the sysobjects table.
Using the code
The project can be built and run with just a little setup. To install
the project, unzip it to a directory of your choosing, for instance c:\projects\dbadoc.
Create a virtual directory in IIS and set the path to c:\projects\dbadoc\client
.
Open Visual Studio and build the project. If you are using VS 2005, the project
should convert with no problems. That's it!
Points of Interest
-
Don't ask me why I used VB for the codebehind and C# for the
data classes. No, really, don't ask.
-
I don't know the configuration steps or failure characteristics when
Crystal Reports is not installed and configured with Visual Studio. If
you go through this setup, kindly email me and I'll update with those
directions.
History
| You must Sign In to use this message board. |
|
| | Msgs 1 to 12 of 12 (Total in Forum: 12) (Refresh) | FirstPrevNext |
|
|
 |
|
|
I'm still getting errors when I load dbadoc, I have already install C#.
I hope that this problems can be resolved.
These are the errors that I get:
Warning 1 Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\Default.aspx.vb 1
Error 2 Type 'DbaFill' is not defined. C:\dbadoc\client\Default.aspx.vb 60
Warning 3 Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\SchemaReport.aspx.vb 5
Error 4 Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb 40
Error 5 Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb 46
Warning 6 Unused local variable: 'startPos'. C:\dbadoc\client\App_Code\CustomErrorHandler.vb 54 13 http://localhost/dbaDoc/
Warning 7 Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\Default.aspx.vb 1 9 http://localhost/dbaDoc/
Error 8 Type 'DbaFill' is not defined. C:\dbadoc\client\Default.aspx.vb 60 26 http://localhost/dbaDoc/
Warning 9 The element 'compilation' has invalid child element 'compilers'. List of possible elements expected: 'assemblies, buildProviders, codeSubDirectories, expressionBuilders'. C:\dbadoc\client\Web.config 13 5 http://localhost/dbaDoc/
Message 10 Could not find schema information for the element 'businessObjects'. C:\dbadoc\client\Web.config 77 3 http://localhost/dbaDoc/
Message 11 Could not find schema information for the element 'crystalReports'. C:\dbadoc\client\Web.config 77 20 http://localhost/dbaDoc/
Message 12 Could not find schema information for the element 'reportMappings'. C:\dbadoc\client\Web.config 77 36 http://localhost/dbaDoc/
Message 13 Could not find schema information for the element 'add'. C:\dbadoc\client\Web.config 77 52 http://localhost/dbaDoc/
Message 14 Could not find schema information for the attribute 'reportName'. C:\dbadoc\client\Web.config 77 56 http://localhost/dbaDoc/
Message 15 Could not find schema information for the attribute 'path'. C:\dbadoc\client\Web.config 77 80 http://localhost/dbaDoc/
------ Build started: Project: http://localhost/dbaDoc/, Configuration: Debug .NET ------ Validating Web Site Building directory '/dbaDoc/'.
C:\dbadoc\client\Default.aspx.vb(1,0): warning BC40056: Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\Default.aspx.vb(60,0): error BC30002: Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb(5,0): warning BC40056: Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\SchemaReport.aspx.vb(40,0): error BC30002: Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb(46,0): error BC30002: Type 'DbaFill' is not defined. Validation Complete ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
This software looks good, if only I can run it.
regards,
Marc
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I get this error when I load it using VS 2005.
Warning 1 Namespace or type specified in the Imports 'DMI.Dbadoc.Data' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. C:\dbadoc\client\SchemaReport.aspx.vb 5 9 C:\dbadoc\client\
Error 2 Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb 40 40 C:\dbadoc\client\
Error 3 Type 'DbaFill' is not defined. C:\dbadoc\client\SchemaReport.aspx.vb 46 19 C:\dbadoc\client\
Warning 4 Unused local variable: 'startPos'. C:\dbadoc\client\App_Code\CustomErrorHandler.vb 54 13 C:\dbadoc\client\
I have loaded both VB an C#
and when I did the conversion it gave me this.
regards,
Marc
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I did what has been instructed on the web site.
I loaded the Solution using VS2005, it then went into converting the solution.
I then got an error saying: one or more projects failed to convert.
Project: dbadoc Filename Status Errors Warnings client\Global.asax.vb file not converted 1 0 Conversion Issues - client\Global.asax.vb: unable to open backup file 1 file Converted: 0 Not converted 1 1 0
Conversion Settings Solution File: G:\Software Development\Documentor\dbaDoc\dbadoc.sln Log Number: 5
Then I got another error message saying:
the application for Project data.csproj is not installed. make sure the application for the project type is installed.
How do I install this?
thanks, Marc
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I'm not sure about the first error - why not try again but skip the option to create a backup of the project. As for the second error - it sounds like you don't have the C# language compiler installed. Reinstall Visual Studio and select C# language option.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I can't figure out why, but no data is displayed when I run this. I'm using VS 2005/SQL 2005/2.0 Framework/Crystal XIR2. After filling in the required fields, the PDF appears, but it's not filled in with any data, as if the database has 0 objects.
Also, do you have a uncompiled version of DbaFill?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The first thing that comes to mind here is - are you supplying a database account that has rights to select system tables? This is required .... if you can give the sa account & password you might get better results.
As for your second question - all the source code is available... dbfill.cs in the data project has the dbafill class in it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I'm running 2005 professional under XP Home so I don't have IIS. When I built your project, I got an this error:
Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. D:\Data\VB\Net\Visual Studio 2005\MCAD\WebApps\dbadoc\client\Web.config 39
So I commented out: statement 39
When I rebuilt the app, it gave me:
Error 1 Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified. D:\Data\VB\Net\Visual Studio 2005\MCAD\WebApps\dbadoc\client\Web.config 13
Line 13 looks like:
I'm using VS 2005 which installs Version 10.2.360 of Crystal Reports. I obviously need to make changes to line 13 to reflect the new version of Crystal Reports.
Can you point me in the right directions?
TIA
Gary
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Gary,
You might try replacing the Crystal references in the dbadoc project with the newer version you are using.
When you open the project in Visual Studio, you'll see all of the Crystal component references under the dbadoc project. Note the names of the referenced assemblies.
Right click on the references folder, click 'Add reference', then look under the .NET tab. You should see all the Crystal components that are installed on your system in the GAC, with the newer version number.
If you see the newer versions as expected, you can then delete the existing references (after noting the assembly names), then readd those Crystal references - using the newer versions.
If you're unsure what Crystal assemblies are installed in the GAC, you can run the following line from the .NET command prompt:
gacutil /l | find "Crystal"
Cheers, M
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
How would you change this to use Reporting Services or just using a web form with asp:dataLists?
Great Article
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for your interest.
The data library DMI.Dbadoc.Data uses the class DbaFill to gather the data. This class is bound to the Crystal report object using the property SchemaTable. This property could also be bound to a DataGrid, GridView, or a DataList. That control could in turn display directly on a page. To do this, I would replace the CrystalReportViewer object in SchemaReport.aspx with the desired grid control.
The DbaFill class uses a single table with the output from ALL the tables; a better modification to the DbaFill class might be to create separate DataTable objects for each Table in the database, and add another property to return an array of those DataTable objects. Then the page codebehind logic could create multiple GridView controls, one for each table, with a title above it with the table name.
As for Reporting Services, I don't have much experience with that, so I couldn't say. Though it would be simple enough to toss the Crystal Reports component and use the Microsoft ReportViewer component instead.
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
One suggestion: increase the size of the "len" field, it doesn't fit more than 3 characters.
Antoine Marie
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
General News Question Answer Joke Rant Admin
|