Click here to Skip to main content
12,446,296 members (57,568 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB .NET
hellow! Actually i want to make crystal report which datasource is dataset but problem is that in my application i create a button and textbox and drag crystalreportviewer and i want to do that when i insert the id in textbox and press the button, the crystal report show only inserted id and coloumns
here is my code below please help me out of this
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
    Inherits System.Windows.Forms.Form
Dim newCmd As OleDbCommand
    Dim conn As OleDbConnection
    Dim da As New OleDbDataAdapter
    Dim ds As New DataSet2
    Dim cr As New CrystalReport1
 
    conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=stdb.mdb;Persist Security Info=False")
    newCmd = conn.CreateCommand()
    newCmd.Connection = conn
    newCmd.CommandText = "select Challan_No, Date, Name from stdb where Challan_No = '" & TextBox1.Text & "'"
    da = New OleDbDataAdapter(newCmd)
    da.Fill(ds, "stdb")
 
    cr = New CrystalReport1()
    cr.SetDataSource(ds)
    CrystalReportViewer1.ReportSource = cr
    conn.Close()
    newCmd.Cancel()
End Sub
end class
Posted 1-Sep-12 22:42pm
Updated 1-Sep-12 23:27pm
v2

1 solution

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

Solution 1

Dont create the object of crystal report.
just give crystalreport1.setdatasource
  Permalink  

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
Web02 | 2.8.160811.3 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2016
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