TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bob Gatto
NA
44
8k
How do I combine 2 tables into 1 datagridview?
Dec 7 2020 10:38 PM
I have 2 tables. One is a list of categories created with the following code:
CREATE
TABLE
[dbo].[Groups] (
[groupname] NVARCHAR (50)
NULL
,
[Id]
INT
IDENTITY (1, 1)
NOT
NULL
,
PRIMARY
KEY
CLUSTERED ([Id]
ASC
)
);
and the other is for storing various data and was created with this:
CREATE
TABLE
[dbo].[Passwords] (
[title] NVARCHAR (100)
NULL
,
[username] NVARCHAR (25)
NULL
,
[
password
] NVARCHAR (25)
NULL
,
[url] NVARCHAR (150)
NULL
,
[notes] NVARCHAR (
MAX
)
NULL
,
[group_no]
INT
NULL
,
[Id]
INT
IDENTITY (1, 1)
NOT
NULL
,
PRIMARY
KEY
CLUSTERED ([Id]
ASC
)
);
Now in table #2 it is possible to have more than one of the same group_no. Also table1.Id = table2.group_no. What I'm looking to do is display a list (maybe a datagridview) that displays the name of the group (table1.groupnane) and the total number of records in table 2 related to that group (table1.Id = table2.group_no).
I think there's some kind of SQL statement but I just can't place it. I'm using c#.
Is there anyone out there who can help? Thanks.
Reply
Answers (
2
)
Sybase Stored procedure error
Please recommend me the best database for desktop level software