Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Query Builder in Visual .NET

Author  Topic 

macupryk
Starting Member

9 Posts

Posted - 2004-09-09 : 00:08:02
When using the query builder I do the following
The StoreID and UsersID are not checked and are included can someone
tell me
why I have this problem.
I have two look up tables which I do a join on.
==========================================================================
This is my query that I built in query builder in visual studio .net
but it
outputs the wrong info. in the webform below.
SELECT
tbl_Users.FullName,
tbl_Users.UserName,
tbl_Stores.Description,
tbl_AccessLevel.Description AS Expr1
FROM
tbl_AccessLevel INNER
JOIN
tbl_Users ON
tbl_AccessLevel.AccessLevelID = tbl_Users.AccessLevelID INNER
JOIN
tbl_Stores ON tbl_Users.StoreID = tbl_Stores.StoreID ORDER BY
tbl_Users.FullName
==========================================================================
I get the following in my webform

FullName UserName Description Expr1 AccessLevel StoredID UsersID
mathieu admin Store1 admin 1 1
1

***** ******
I have defined three tables:
CREATE TABLE [tbl_Users] (
[UsersID] [int] NOT NULL ,
[StoreID] [int] NOT NULL ,
[FullName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[UserName] [nvarchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[PasswordHash] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT
NULL ,
[PasswordSalt] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT
NULL ,
[AccessLevelID] [int] NOT NULL ,
[ReportToID] [int] NOT NULL ,
[ModifiedDate] [datetime] NOT NULL ,
[CreationDate] [datetime] NOT NULL ,
CONSTRAINT [PK_tbl_Users] PRIMARY KEY NONCLUSTERED
(
[UsersID]
) ON [PRIMARY] ,
CONSTRAINT [FK_tbl_Users_tbl_AccessLevel1] FOREIGN KEY
(
[AccessLevelID]
) REFERENCES [tbl_AccessLevel] (
[AccessLevelID]
),
CONSTRAINT [FK_tbl_Users_tbl_Stores1] FOREIGN KEY
(
[StoreID]
) REFERENCES [tbl_Stores] (
[StoreID]
)
) ON [PRIMARY]
GO

alter table [dbo].[tbl_Users] nocheck constraint
[FK_tbl_Users_tbl_AccessLevel1]
GO

alter table [dbo].[tbl_Users] nocheck constraint
[FK_tbl_Users_tbl_Stores1]
GO

=============================================
CREATE TABLE [tbl_AccessLevel] (
[AccessLevelID] [int] NOT NULL ,
[Description] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL
,
CONSTRAINT [PK_AccessLevel] PRIMARY KEY NONCLUSTERED
(
[AccessLevelID]
) ON [PRIMARY]
) ON [PRIMARY]
GO

=============================================
CREATE TABLE [tbl_Stores] (
[StoreID] [int] NOT NULL ,
[Description] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL
,
CONSTRAINT [PK_Store] PRIMARY KEY NONCLUSTERED
(
[StoreID]
) ON [PRIMARY]
) ON [PRIMARY]
GO


I have a deadline to meet and I am stuck on this one. If anyone knows what the problem is in this could you please help me out it would be appreciated so much.Sincerely!

Mathieu Cupryk

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-09 : 00:28:11
I can't quite understand what your problem is. Is it that you're getting UserID and StoreID and you don't want them?
First of all, you should try and run the query in SQL Query Analyser to make sure that you're getting back the right data. It may be that your webform has too many fields configured.
Go to Top of Page
   

- Advertisement -