TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bhavesh Vankar
755
1.2k
89.2k
Crystal Report printing using button by where clause.
Jan 23 2021 9:07 AM
in my practicle i want to print selected record by id or gr name but its not wokring report showing all records not seletcted where is mistakes kindly suggest me right code.
protected
void
btnPrint_Click(
object
sender, EventArgs e)
{
SqlConnection con =
new
SqlConnection(@
"Connection string"
);
con.Open();
SqlCommand cmd =
new
SqlCommand(
"Select * from student_details Where grno Like'"
+ TextBox1.Text +
"' or name like'"
+ studentname +
"%'"
,con);
SqlDataAdapter sda =
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
sda.Fill(ds);
ReportDocument crReport =
new
ReportDocument();
crReport.Load(Server.MapPath(
"~/StudentsRecord.rpt"
));
crReport.SetDataSource(ds.Tables[
"student_details"
]);
CrystalReportViewer1.ReportSource = crReport;
crReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,
false
,
"Student Records"
);
con.Close();
}
Reply
Answers (
3
)
How to check a List for values
display values with headers from database table using VBscript