on 09-18-2008 5:46 PM
Hi, I've been trying to solve this problem for several weeks now, and I have exhausted all of my knowledge and experience. I need help, and I hope someone here can give me some direction.
I am using VB 2008, and the CR that comes bundled with VS 2008 Pro. My database is a SQL Server 2005 CE v3.5 (a *.sdf file). I am connecting to the database through a dataset, and I am displaying the report in a CrystalReportViewer.
My dataset consistes of two tables:
1) tblCustomers which has a primary key "CustID", and contains only customer contact and personal information.
2) tblDateVisited which has a primary key of "VisitID", but it also has a column titled "CustID". Basically, every time a customer visits the business, details of that visit are recorded in tblDateVisited, and that record is associated with the customer by their CustID.
Here's what I'm trying to accomplish: I want to be able to display only Customer records when the customer has visited and that visit matches certain criteria. Right now, I am trying to match visits from the "tblVisitDate.PlayerType" column. If the customer has ever had a visit where they matched a particular player type, I want to see those customer records.
I don't know what I'm doing wrong, though. I can search a dataset if I am only querying one table and pulling records from that table. However, whenever I try to add a second table and perform queries on that table to get records from the first table, I can't return any records.
If it helps, I am trying to use one CrystalReportViewer to display multiple reports (user choice) and here's how I'm loading the report into the viewer:
Me.tblCustomersTableAdapter.Fill(Me.dsPlayerTypeReports.tblCustomers)
Me.tblDateVisitedTableAdapter.Fill(Me.dsPlayerTypeReports.tblDateVisited)
Me.ReportFile.SetDataSource(dsPlayerTypeReports.Tables(1))
I am suspicious that my problem is in the Tables(1) method. It confuses me that I can only assign one table as a datasource when I obviously need access to two tables to make this selection work.
Whatever the case, I'm at the end of my rope with this one. I'm not prone to giving up, but I'm at a dead end currently.
Any attempt to assist me with this will be greatly appreciated, successful or not.
Thanks in advance!
-Will
you should use outer joins, join the tables on cust id
then display all your data.
then create a selection criteria or parameter to filter the data.
are you connecting via odbc?
is this a stored procedure?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I am connected via ADO.NET. I don't think SQL CE can connect through ODBC (or if it can, I haven't been able to figure out how, yet). So this isn't a stored procedure.
When I examine the link, I can only choose an Inner Join or a Left Outer Join. Right Outer and Full Outer are not available. Could this be a problem with the dataset I'm using?
Could you explain what you mean by display all of the records and then choose the selection criteria?
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.