|
-
Jan 24th, 2005, 08:26 AM
#1
Thread Starter
New Member
Datagrid to display data from two tables
Hi,
I am trying to display data from two tables in the one datagrid using an ado data control. The first table is expenses and the second is rates and they are joined by rateid. The trouble is I wasnt to show expenses for just one employee..
Having major difficulty. Any help would be appreciated.
-
Jan 24th, 2005, 08:52 AM
#2
Fanatic Member
Re: Datagrid to display data from two tables
The best way to achive what you are after is to use the MSHFlexGrid control and implementing a Shape command
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Jan 24th, 2005, 08:56 AM
#3
Hyperactive Member
Re: Datagrid to display data from two tables
Hi,
In this case you have to establish SQL Query and then pass the SQL Query into the ADODC Data Control.
Here's a simple code it might help you. But before that this code it return the employee how much contacts that he / she have where the employee name is located in the Combo Box.
VB Code:
'The query is response on the Click Event.
Private Sub Combo1_Click()
SQL = "Select EmployeesData.[FirstName], EmployeesData.[SecondName], Contacts.[Mobile]"
SQL = SQL & "From [EmployeesData], [Contacts]"
SQL = SQL & "Where EmployeesData.[EmpID] = Contacts.[EmpID]"
SQL = SQL & "And EmployeesData.[FirstName]='" & Combo1.Text & "';"
Adodc1.RecordSource = SQL ' Execute your query
Set DataGrid1.DataSource = Adodc1 ' Bind to the data control
Hope this will help you.
Best Regards,
Habibalby
Current Project: General Employees Database (Employees Information) & (Training Details).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|