Click here to Skip to main content
Rate this: bad
good
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 23:42pm
Edited 2-Sep-12 0:27am
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
0 BillWoodruff 360
1 Mathew Soji 309
2 DamithSL 225
3 Afzaal Ahmad Zeeshan 202
4 Maciej Los 190
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 3 Sep 2012
Copyright © CodeProject, 1999-2014
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