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.
Author |
Topic |
macupryk
Starting Member
9 Posts |
Posted - 2004-09-09 : 00:08:02
|
When using the query builder I do the followingThe StoreID and UsersID are not checked and are included can someone tell mewhy 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 itoutputs the wrong info. in the webform below.SELECT tbl_Users.FullName, tbl_Users.UserName, tbl_Stores.Description, tbl_AccessLevel.Description AS Expr1FROM tbl_AccessLevel INNERJOIN tbl_Users ON tbl_AccessLevel.AccessLevelID = tbl_Users.AccessLevelID INNER JOINtbl_Stores ON tbl_Users.StoreID = tbl_Stores.StoreID ORDER BYtbl_Users.FullName==========================================================================I get the following in my webformFullName UserName Description Expr1 AccessLevel StoredID UsersIDmathieu admin Store1 admin 1 11***** ******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 NOTNULL , [PasswordSalt] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOTNULL , [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]GOalter table [dbo].[tbl_Users] nocheck constraint[FK_tbl_Users_tbl_AccessLevel1]GOalter 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]GOI 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. |
 |
|
|
|
|
|
|