【发布时间】:2013-12-08 14:27:29
【问题描述】:
我正在制作一个发票程序,我需要从我的数据库中的 2 个表中进行准备,我在两个表中建立了一个名为 Invoice_No 的关系联合,我调用了这两个表并从 Invoice_No 调用了我的发票数据,但是当我执行所有工作时好,输入数据后,当我按下 打印按钮它给我一个错误不明确的列名 Invoice_No,给我一个解决方案
Cursor = Cursors.WaitCursor;
frmSalesinvoice frm = new frmSalesinvoice();
invoice rpt = new invoice();
//The report you created.
SqlConnection myConnection = default(SqlConnection);
SqlCommand MyCommand = new SqlCommand();
SqlDataAdapter myDA = new SqlDataAdapter();
DS_Invoice_all myDS = new DS_Invoice_all();
myConnection = new SqlConnection(cs);
MyCommand.Connection = myConnection;
MyCommand.CommandText = "select * from Invoice_Info,Items_Soled where Items_Soled.Invoice_No=Invoice_Info.Invoice_No and Invoice_No= '" + textBoxInvoiceNo.Text + "'";
MyCommand.CommandType = CommandType.Text;
myDA.SelectCommand = MyCommand;
myDA.Fill(myDS, "Invoice_Info");
myDA.Fill(myDS, "Items_Soled");
rpt.SetDataSource(myDS);
frm.crystalReportViewer1.ReportSource = rpt;
frm.Show();
【问题讨论】:
标签: c# sql-server winforms crystal-reports