0 Replies - 1246 Views - Last Post: 10 November 2012 - 12:28 AM Rate Topic: -----

#1 pratik65  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 10-September 12

i am trying to execute a query an get the result on Crystal report

Posted 10 November 2012 - 12:28 AM

i am trying to Execute an sql query and get the result on the crystal report From Marks_Master Table Table . I tried Following Code But It is Giving Me Exception As :

System.IO.FileNotFoundException was unhandled
Message=Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class frmMarks_Report
    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
        Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=grade;Integrated Security=True;Pooling=False")
        Dim ds As DataSet
        Dim da As SqlDataAdapter
        Try
            conn.Open()
            Dim query As String = " SELECT Gr_No,Name,Class,Division,Semester,Exam,Subject,Max_Marks,Min_Marks,Obtained_Marks FROM Marks_Master WHERE Class='" & cmbClass & "' and Division='" & cmbDiv & "' and Exam='" & cmbExam & "' "
            da = New SqlDataAdapter(query, conn)
            ds = New DataSet
            da.Fill(ds, "Marks_Master")
            Dim mt As ReportDocument
            mt = New CrystalReport1
            mt.SetDataSource(ds)
            Me.CrystalReportViewer1.ReportSource = mt
            mt.Refresh()
            CrystalReportViewer1.Show()
        Catch ex As Exception
            MessageBox.Show(ex.ToString())
        Finally
            If conn.State = ConnectionState.Open Then
                conn.Close()
            End If
        End Try
    End Sub
End Class




Is This A Good Question/Topic? 0
  • +

Page 1 of 1