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
Sk Jha
NA
113
43.4k
how to transfer data from datagridview to crystal report.
May 19 2018 10:39 PM
how to transfer data from datagridview to crystal report.
i done this given code but data is not display on crystal report.
private
void
SalesReportPrint_Load(
object
sender, EventArgs e)
{
if
(con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
DataSetSalesReport dsr =
new
DataSetSalesReport();
if
(from!=
""
&& to !=
""
)
{
OleDbCommand cmd =
new
OleDbCommand(
"SELECT order_item.order_ID, order_user.firstname, order_user.lastname, order_user.billtype, order_user.purchase_date,order_item.barcode, order_item.product, order_item.price, order_item.qty, order_item.discount, order_item.total, order_item.cgst, order_item.sgst FROM order_item right JOIN order_user ON val(order_item.order_id) = order_user.ID where purchase_date between '"
+ from +
"' and '"
+ to +
"'"
, con);
cmd.ExecuteNonQuery();
DataTable dt =
new
DataTable();
OleDbDataAdapter da =
new
OleDbDataAdapter(cmd);
da.Fill(dsr.order);
}
else
{
OleDbCommand cmd1 =
new
OleDbCommand(
"SELECT order_item.order_ID, order_user.firstname, order_user.lastname, order_user.billtype, order_user.purchase_date,order_item.barcode, order_item.product, order_item.price, order_item.qty, order_item.discount, order_item.total, order_item.cgst, order_item.sgst FROM order_item INNER JOIN order_user ON val(order_item.order_id) = order_user.ID;"
, con);
cmd1.ExecuteNonQuery();
DataTable dt1 =
new
DataTable();
OleDbDataAdapter da1 =
new
OleDbDataAdapter(cmd1);
da1.Fill(dsr.order);
}
CrystalReportSales salesReport =
new
CrystalReportSales();
salesReport.SetDataSource(dsr);
salesReport.SetParameterValue(
"from"
, from);
salesReport.SetParameterValue(
"to"
, to);
salesReport.SetParameterValue(
"gtotal"
, gtotal);
crystalReportViewer1.ReportSource = salesReport;
}
}
Reply
Answers (
1
)
how export Array of a complex class to Excel using Interop
Can we use style Tag after Script Tag..?