hey i m generating a crystal report in vs 2010 using linq to sql in desktop apps.
But i m getting this error at the click event of the print button.
Error: DataSet does not support System.Nullable<>
my store procedure:
alter proc wholesale_print
(
@invoice_no varchar(15),
@cust_id int
)
as
begin
select cust.customer_name,item.item_name,inv.invoice_no,inv.Qty,inv.price,
inv.item_amount,inv.disc,inv.disc_amt,inv.vat,inv.vat_amt,inv.total_amt
from inv_invoice_detail as inv
inner join Inv_Customer_Name as cust
on inv.cust_id=cust.customer_id
inner join Inv_item_master as item
on inv.item_id=item.item_id
where inv.invoice_no=@invoice_no
and inv.cust_id=@cust_id
end
code which i wrote at the click event of print button
Inventory_dataDataContext linq = new Inventory_dataDataContext();
var abc = linq.wholesale_print(txt_invoice.text,Convert.ToInt32(cmb_cust.selectedvalue);
rpt.SetDataSource(abc);
crystalReportViewer1.ReportSource = rpt;
crystalReportViewer1.Refresh();*/


Umesh Kumar126 reputationPosted May 14, 2014, 4:51 AM EDT
Any column in your query is coming null, if it is null give a default value
see the code below
private void Form2_Load(object sender, EventArgs e) { RST_DBDataContext db = new RST_DBDataContext(); var d = (from s in db.TblSpareParts select new { s.SPartName?? DBNull.Value, s.SPartCode?? DBNull.Value, s.ModelID ?? DBNull.Value, s.SPartLocation ?? DBNull.Value, s.SPartActive ?? DBNull.Value, s.SPartSalePrice ?? DBNull.Value, }).ToArray(); CrystalReport1 c = new CrystalReport1(); c.SetDataSource(d); crystalReportViewer1.ReportSource = c; }