Click here to Skip to main content
12,998,654 members (131,231 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to create a Crystal Report with a dynamic data source. When i click the report button, the crystal report shows up just fine, but when i click any button the Crystal Report tool bar (i.e. Next page, Export To, etc.), i get a pop with the Error "No valid report source is available."
My Report viewer coding:

Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.HttpApplication
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource

Partial Class Reportviewer
Inherits System.Web.UI.Page
Public str As String
Public rptname As String
Public sf As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
Dim printModeList As ArrayList = New ArrayList()
Dim con As New ConnectionInfo
Dim con1 As New ConnectionInfo
Dim db1 As Database
Dim dbs As Tables
Dim db As Table
Dim tab As TableLogOnInfo
rptname = Session("rptname")
str = Convert.ToString(Session("Str")) '"
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument

With con
.UserID = "sa"
.Password = "sa"
.DatabaseName = "TASHEEL"
' .ServerName = "Develope-PC"
.ServerName = "TASHEEL"

End With
If rptname = "inv_rep.rpt" Then
End If
db1 = rpt.Database
dbs = db1.Tables
For Each db In dbs
tab = db.LogOnInfo
tab.ConnectionInfo = con
CrystalReportViewer1.SelectionFormula = str
'rptname = Session("rptname") '"INV_LIST.rpt"
CrystalReportViewer1.ReportSource = rpt
Session("Str") = ""
Session("rptname") = ""

End If
End Sub

End Class
Posted 19-Apr-13 19:47pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170622.1 | Last Updated 20 Oct 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100