我正在做一個發票計劃,我需要從我的數據庫中的2個表中準備,我在兩個表中都創建了一個名稱爲Invoice_No的關係聯盟,並且我打電話給兩者並從Invoice_No調用了我的發票數據,但是當我執行所有工作良好,輸入數據和當我按下 打印按鈕,它給我的錯誤不明確的列名Invoice_No後,給我一個解決方案Crystal報表模糊列名稱錯誤。
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();
如何前綴是什麼? – Xeroth
你說你有兩張桌子。我們將它們命名爲table1和table2。假設每個表都有一個字段。我們將其命名爲field1。所以你可以將它作爲前綴table1.field1和table2.field1。 –