melkanzi Posted September 5, 2007 Posted September 5, 2007 Hi I'm trying to select from 3 tables Orders,Receipts and Customers. I get the records that I want throght SQL but when I attempt to view the data in Crystal Report I get na empty report. Here is the code: Dim con As New OleDb.OleDbConnection(My.Settings.KazaConstructionConnectionString) Dim ds As New DataSet Dim com As New OleDb.OleDbCommand("Select Receipts.ReceiptNumber,Customers.CustomerID,Customers.Name,Orders.OrderID,Orders.Normal,Orders.Resistant,Orders.Total,Orders.PaymentType,Orders.EmployeeName from Orders,Customers,Receipts where Customers.CustomerID=Orders.CustomerID and Customers.CustomerID=Receipts.CustomerID and Orders.OrderDate=#" & nowdate & "#", con) Dim da As New OleDb.OleDbDataAdapter(com.CommandText, con) Try con.Open() da.Fill(ds) con.Close() Catch ex As Exception End Try If ds.Tables(0).Rows.Count = 0 Then MessageBox.Show("There are no Orders made today", "No Orders", MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub End If Dim rcpt As New DailyReport Dim rpt As New Reports rcpt.SetDataSource(ds.Tables(0)) rpt.CRV.ReportSource = rcpt rpt.ShowDialog() Quote
Administrators PlausiblyDamp Posted September 6, 2007 Administrators Posted September 6, 2007 If you step through the code does the DataSet contain the correct data after the da.Fill(ds) line? Also the line Dim da As New OleDb.OleDbDataAdapter(com.CommandText, con) would be better written as Dim da As New OleDb.OleDbDataAdapter(com) as it saves creating an extra command object. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
melkanzi Posted September 6, 2007 Author Posted September 6, 2007 Thanks for the reply, It does get me the correct data when I read the data returned into the dataset I get the correct data. The problem is in Crystal Report Quote
melkanzi Posted September 8, 2007 Author Posted September 8, 2007 Please help guys the project is halted and I'm supposed to submit it very soon. Thanks Quote
Administrators PlausiblyDamp Posted September 9, 2007 Administrators Posted September 9, 2007 Does the DataSet contain the same tables etc. that the report is expecting? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
melkanzi Posted September 11, 2007 Author Posted September 11, 2007 Thank you for the help I've found the solution in another thread. All I had to do is write: Report.Database.Tables(0).SetDatasource(ds.Tables(0)) Report.Database.Tables(1).SetDatasource(ds.Tables(1)) Thanks again Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.