Skip to Content

Reports with error "Database access failed"

Hello everybody

i'm writing this thread because in this period on my web app deployed with asp.net and vb.net i have on my IIS an error called "Database access failed" when someone try to create a report.

I can attach my code because i have tried some tentatives but i didn't solve anything.

The only choise to restart export reports is a IIS reset command on my Internet Information Service.

I hope someone can help me to solve my problem.

Here my code to export a report:

Dim da as new Data.SqlClient.SqlDataAdapter

dim rptDocument as ReportDocument

dim connection = "connection to my database"

da.SelectCommand = New SqlCommand(ssql, connection) //here my query with my connection

da.Fill(ds, table) //declared dataset and table

reportPath = path

rptDocument = New ReportDocument

rptDocument.Load = reportPath //path where is my report

rptDocument.SetDataSource(ds)

// Then here i do other queries to export a logo and then

rptDocument.OpenSubreport("RPT_Logo.rpt").setDataSource(ds1)

dim exportOpts as ExportOptions = new ExportOptions()

dim pdfRtfWordOpts as PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()

dim destinationOpts as DiskFileDestionationOptions = ExportOptions.CreateDiskFileDestinationOptions()

exportOpts.ExportFormatOptions = pdfRtfWordOpts

exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat

destinationOpts.DiskFileName = mypath

exportOpts.ExportDestinationOptions = destinationOpts

exportOpts.ExportDestinationType = ExportDestinationType.DiskFile

rptDocument.Export(exportOpts)

rptDocument.Close()

rptDocument.Dispose()
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Feb 20, 2019 at 03:22 PM

    Make sure the dataset matches the report exactly.

    Does it work in CR Designer?

    Need more details on on the work flow.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.