cancel
Showing results for 
Search instead for 
Did you mean: 

Reports with error "Database access failed"

0 Kudos

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()

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Make sure the dataset matches the report exactly.

Does it work in CR Designer?

Need more details on on the work flow.