Click here to Skip to main content
15,915,603 members
Home / Discussions / Database
   

Database

 
AnswerRe: SqlParameter Pin
Colin Angus Mackay23-Apr-06 0:12
Colin Angus Mackay23-Apr-06 0:12 
QuestionUpdate Database through Dataset using DataAdapter? Pin
MudkiSekhon21-Apr-06 21:20
MudkiSekhon21-Apr-06 21:20 
QuestionTextBox databinding Problem Pin
wasife21-Apr-06 19:36
wasife21-Apr-06 19:36 
GeneralDocument SQLServer Indexes Pin
Tim Carmichael21-Apr-06 5:52
Tim Carmichael21-Apr-06 5:52 
GeneralRe: Document SQLServer Indexes Pin
Paul Brower21-Apr-06 6:00
Paul Brower21-Apr-06 6:00 
QuestionSearching Capabilities Pin
Usman Tasleem Akshaf21-Apr-06 2:25
Usman Tasleem Akshaf21-Apr-06 2:25 
AnswerRe: Searching Capabilities Pin
Colin Angus Mackay21-Apr-06 2:36
Colin Angus Mackay21-Apr-06 2:36 
QuestionSQL 2000 RS Help needed! Pin
Hans Vergouwen21-Apr-06 0:16
Hans Vergouwen21-Apr-06 0:16 
We are using SAP business one as CRM.
We work with SQL 2000 SP4 and Reporting Services for SQL 2000

Situation
Table 1: OCRD
This table contains most of the data; cardcode /name / phonenumbers /email / biling addres / qrygroup1 tm qrygroup64 in our application you can put a checkmark on a properties tab and we use these properties to define which company or Formula these company's belong to.. in our case if qrygroup1 has a checkmark it means: the customer is part of the formula "profile" if qrygroup4 is checked he is part of the "Bonusbikes" formula

Table 2: CRD1
This table is a "sub table of OCRD" and it contains : cardcode / street /zip /city /country. The field cardcode is the same as in table OCRD but can appear more than one time in the list when customer has more than one adress: for example billing address and Supply address / some customers have more than one branch, the customers cardcode will be the same only an extra line is added in CRD1 table .they are both located in this table, the billing address is also in OCRD))

Table 3:
This table contains the qrygroup columns from OCRD
Groupcode / Groupname (groupcode= 1 refers to qrygroup1 from OCRD the groupname will be Profile, groupcode 4 is qrygroup4 from OCRD and that groupname is BONUSBIKES)

In my report I want to filter on a couple criteria but the only one giving problems is this one!
I want to generate the report so, that I can filter on "Profile / bonusbikes / alle "
-------------------------------------------------------------
In SQL enterprise admin I created two views which contain the following queries:

View1: LEDEN

SELECT TOP 100 PERCENT dbo.OCRD.CardCode AS Lidnummer,
dbo.OCQG.GroupName AS Formule,
dbo.OCRD.CardName AS Naam,
dbo.OCRD.Phone1 AS Telefoon,
dbo.OCRD.frozenFor AS Geblokkeerd,
dbo.OCRD.E_Mail AS [E-mail],
dbo.OCRD.SlpCode AS Accountbegeleider,
dbo.CRD1.ZipCode, dbo.CRD1.City,
dbo.CRD1.Country, dbo.CRD1.Street
FROM dbo.OCRD RIGHT OUTER JOIN
dbo.CRD1 ON dbo.OCRD.CardCode = dbo.CRD1.CardCode CROSS JOIN dbo.OCQG
WHERE (dbo.OCQG.GroupName = 'Profile') AND (dbo.OCRD.QryGroup1 = 'Y') AND
(dbo.OCRD.CardType = 'c') AND (dbo.CRD1.AdresType = 's') OR
(dbo.OCQG.GroupName = 'Fietswereld') AND (dbo.CRD1.AdresType = 's') AND
(dbo.OCRD.QryGroup2 = 'Y') OR
(dbo.OCQG.GroupName = 'BBG') AND (dbo.CRD1.AdresType = 's') AND
(dbo.OCRD.QryGroup3 = 'Y') OR
(dbo.OCQG.GroupName = 'bonusbikes') AND
(dbo.CRD1.AdresType = 's') AND (dbo.OCRD.QryGroup4 = 'Y')


This returns : (I left out some fields)
Lidnummer Formule Naam Telefoon geblokkeerd e-mail
8479 profile jansen 00000 n jansen@profile.nl
8442 bonusbikes klaasen 11111 n klaasen@bonusbikes.nl
8888 BBG smith 22222 n smith@bireto.com


View2: FORMULES
SELECT GroupName, GroupCode
FROM dbo.OCQG
WHERE (GroupCode = 1) OR
(GroupCode = 2) OR
(GroupCode = 3) OR
(GroupCode = 4)

This returns
Profile
Fietswereld
BBG
Bonusbikes
-----------

DOTNET
In visual studio dot net I created a new report project added the datasource and created two datasets:

Dataset 1: LEDEN
Dataset 2: FORMULES

In dataset 1, I place all columns from VIEW 1: LEDEN
Than I set a parameter on FORMULE in dataset LEDEN -> @Formule

In dataset 2: FORMULES, I place the results of VIEW 2: FORMULES

I create the report parameter with values from query and select Dataset: FORMULES
To have the “select all” option I place the following in dataset LEDEN
--------------------------------
UNION
Select ‘-1’, ‘Alle’
--------------------------------

The entire query in dataset 2 now looks like:
-------------------------------------
SELECT Groupname
FROM formulas
UNION
SELECT ‘-1’, ‘Alle’
-------------------------------------

When I run my report I get an error:
The graphical designer doesn’t support UNION etc… this is normal, I know!
But then I get another error : could not generate a list of fields for the query , union must have an equal number of expressions! ?????

What is it that I do wrong or what can I do to resolve this!
Thanks in advance!

Hans Vergouwen
QuestionSuggestions for JOINs for audit tables Pin
Daire Cunningham20-Apr-06 23:20
Daire Cunningham20-Apr-06 23:20 
Questionpassing paramter to sp_ExecuteSql Pin
rohitgraycell20-Apr-06 23:12
rohitgraycell20-Apr-06 23:12 
AnswerRe: passing paramter to sp_ExecuteSql Pin
Colin Angus Mackay21-Apr-06 1:11
Colin Angus Mackay21-Apr-06 1:11 
QuestionBackup on 2005 and restore on 2000 Pin
phimix20-Apr-06 21:56
phimix20-Apr-06 21:56 
QuestionSQL select Statement Pin
alexfromto20-Apr-06 6:26
alexfromto20-Apr-06 6:26 
AnswerRe: SQL select Statement Pin
Eric Dahlvang20-Apr-06 8:39
Eric Dahlvang20-Apr-06 8:39 
GeneralRe: SQL select Statement Pin
alexfromto21-Apr-06 2:49
alexfromto21-Apr-06 2:49 
AnswerRe: SQL select Statement Pin
Luis Alonso Ramos20-Apr-06 15:57
Luis Alonso Ramos20-Apr-06 15:57 
QuestionHow to make Web Application more Secure in Asp.Net???? Pin
pal_vaidya20-Apr-06 4:14
pal_vaidya20-Apr-06 4:14 
Question[FYI]Service pack release for both Server and Express edition of SQL2005 Pin
Jerry Hammond20-Apr-06 4:12
Jerry Hammond20-Apr-06 4:12 
AnswerRe: [FYI]Service pack release for both Server and Express edition of SQL2005 Pin
Paul Conrad20-Apr-06 4:45
professionalPaul Conrad20-Apr-06 4:45 
Question????How to do it???? Pin
papa198020-Apr-06 1:32
papa198020-Apr-06 1:32 
Question[SQL Server] Alter a function which is used as a column default Pin
Duncan Edwards Jones20-Apr-06 1:16
professionalDuncan Edwards Jones20-Apr-06 1:16 
AnswerRe: [SQL Server] Alter a function which is used as a column default Pin
Duncan Edwards Jones20-Apr-06 5:12
professionalDuncan Edwards Jones20-Apr-06 5:12 
Questiongroup by clause Pin
dansoft19-Apr-06 6:15
dansoft19-Apr-06 6:15 
AnswerRe: group by clause Pin
Colin Angus Mackay19-Apr-06 6:38
Colin Angus Mackay19-Apr-06 6:38 
GeneralRe: group by clause Pin
dansoft19-Apr-06 7:05
dansoft19-Apr-06 7:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.