on 05-13-2011 11:18 PM
when I am trying to open a crystal report through code ( visual basic 2010 ) I get the error
the report has no tables
I am using SQL SERVER 2008 R2
HERE IS THE CODE I WROTE
Imports System.Data
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms
Imports CrystalDecisions.Shared
Public Class frmRep
Dim objConnection As New OleDbConnection("Provider=SQLOLEDB;Data Source=ASHRAF-PC\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=TEST")
Dim objDataAdapter As New OleDbDataAdapter()
Dim objDataSet As New DataSet()
Private Sub CrystalReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles CrystalReportViewer1.Load
End Sub
Private Sub frmRep_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim cr As New ReportDocument
objDataAdapter.SelectCommand = New OleDbCommand()
objDataAdapter.SelectCommand.Connection = objConnection
objDataAdapter.SelectCommand.CommandType = CommandType.Text
objDataAdapter.SelectCommand.CommandText = "select * from bands"
objConnection.Open()
objDataAdapter.Fill(objDataSet, "bands")
objConnection.Close()
cr.Load("D:\MY VB 2010 PROJECTS\test2\test2\CrystalReport1.rpt")
cr.SetDataSource(objDataSet.Tables("bands"))
CrystalReportViewer1.ReportSource = cr
CrystalReportViewer1.Refresh()
End Sub
End Class
I suggest you post that question in a Crystal Reports forum.
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.