My WebForm having one TextBox, a Button and CrystalReportViewer. If i enter value in TextBox click Button then i want filtered Crystal Report based on TextBox value.
Help me.
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jun 23, 2012, 1:06 PM
Imports System.Data.SqlClient
Public Class Report
Inherits System.Windows.Forms.Form
Dim r1 As New CrystalReport1
Private Sub btnshow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnshow.Click
con.Open()
str = "select * from student where sid='" & TextBox1.Text & "'"
com = New SqlCommand(str, con)
sqlda = New SqlDataAdapter(com)
ds = New DataSet
sqlda.Fill(ds, "student")
con.Close()
r1.SetDataSource(ds)
CrystalReportViewer1.ReportSource = r1
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.Refresh()
End Sub
End Class
Thanks
Rajesh KumarPosted Jun 24, 2012, 12:44 AM
First of all i tried like this code you provide and it can't be export and print the report which was filtered by textbox value. It asks logon info, but i want the report without logon.
Kindly provide asp.net code with c# or vb.
Thanks again..