我已經在vb.net寫了一個查詢,以顯示在水晶報表,但一個列名Customer.Name顯示在報告中都排在這裏我的查詢和代碼Crystal報表
Dim rpt As New rptSales2 'The report you created.
Dim myConnection As SqlConnection
Dim MyCommand, MyCommand1 As New SqlCommand()
Dim myDA, myDA1 As New SqlDataAdapter()
Dim myDS, myDS1 As New DataSet 'The DataSet you created.
myConnection = New SqlConnection(cs)
MyCommand.Connection = myConnection
MyCommand1.Connection = myConnection
MyCommand.CommandText = "select invoiceinfo.Inv_ID, invoiceinfo.InvoiceNo,invoiceinfo.InvoiceDate, Customer.Name, sum(InvoiceInfo.GrandTotal)-sum(invoiceinfo.prevdue) as grandtotal, sum(invoiceinfo.TotalPaid) as totalpaid,ISNULL(sum(Balance),0)-ISNULL(sum(prevdue),0) as currentdue,ISNULL(sum(prevdue),0) as prevdue,sum(invoiceinfo.Balance) as Balance from InvoiceInfo inner join Customer on InvoiceInfo.CustomerID = Customer.ID where InvoiceDate between @d1 and @d2 group by invoiceinfo.InvoiceDate,invoiceinfo.InvoiceNo,Customer.Name,InvoiceInfo.TotalPaid,invoiceinfo.Inv_ID"
MyCommand.Parameters.Add("@d1", SqlDbType.DateTime, 30, "Date").Value = dtpDateFrom.Value.Date
MyCommand.Parameters.Add("@d2", SqlDbType.DateTime, 30, "Date").Value = dtpDateTo.Value.Date
MyCommand1.CommandText = "SELECT * from Company"
MyCommand.CommandType = CommandType.Text
MyCommand1.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA1.SelectCommand = MyCommand1
myDA.Fill(myDS, "InvoiceInfo")
myDA.Fill(myDS, "Customer")
myDA1.Fill(myDS, "Company")
相同
這裏的SQL查詢select invoiceinfo.Inv_ID, invoiceinfo.InvoiceNo,invoiceinfo.InvoiceDate, Customer.Name, sum(InvoiceInfo.GrandTotal)-sum(invoiceinfo.prevdue) as grandtotal, sum(invoiceinfo.TotalPaid) as totalpaid,ISNULL(sum(Balance),0)-ISNULL(sum(prevdue),0) as currentdue,ISNULL(sum(prevdue),0) as prevdue,sum(invoiceinfo.Balance) as Balance from InvoiceInfo inner join Customer on InvoiceInfo.CustomerID = Customer.ID where InvoiceDate between @d1 and @d2 group by invoiceinfo.InvoiceDate,invoiceinfo.InvoiceNo,Customer.Name,InvoiceInfo.TotalPaid,invoiceinfo.Inv_ID
但表現出良好的SQL服務器同治工作室查詢
在這裏水晶報表和SQL Server同治工作室的截屏兩種查詢
https://gyazo.com/569dad19a7957f35eb449fd45adf1177 https://gyazo.com/f8b6b8b56ab05c4c54a9b49e60ee6cae
請幫我在這一點上
您可以發佈水晶報表設計的屏幕截圖嗎? – heringer
是的,在這裏起訴晶體報告設計的屏幕截圖 https://gyazo.com/fc7558ee5ea4ac7b6ac48b7cfcbd6eab – mdkamrul
它對我來說沒有意義,但看起來客戶端連接並不是預期的結果。您能否將Inv_ID和名稱(客戶名稱)複製到詳細會話併發布結果的屏幕截圖? – heringer