private void btnPrint_Click(object sender, EventArgs e)
{
try
{
Cursor = Cursors.WaitCursor;
timer1.Enabled = true;
cryinvoice rpt = new cryinvoice();
//The report you created.
cmd = new OleDbCommand();
OleDbDataAdapter myDA = new OleDbDataAdapter();
DataSet myDS = new DataSet();
//The DataSet you created.
con = new OleDbConnection(cn);
cmd.Connection = con;
cmd.CommandText = "SELECT Invoice.*,ProductSold.*,Customer.* FROM Invoice,Customer,ProductSold WHERE (Invoice.invoiceID = ProductSold.invoiceID) AND (Invoice.cusomerID = Customer.CustomerID) AND (Invoice.invoiceID = 'INV-83351351')";
cmd.CommandType = CommandType.Text;
myDA.SelectCommand = cmd;
myDA.Fill(myDS, "Invoice");
//myDA.Fill(myDS, "");
myDA.Fill(myDS, "ProductSold");
myDA.Fill(myDS, "Customer");
rpt.SetDataSource(myDS);
Forminvoiveinfo frm = new Forminvoiveinfo();
frm.crystalReportViewer1.ReportSource = rpt;
frm.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
在图片中,你显示invoiceID字段绑定然后不显示invoiceID的数据为什么? 我还有三个新的报告,但在同一个错误中不显示invoiceID?