Click here to Skip to main content
16,008,010 members
Home / Discussions / Database
   

Database

 
GeneralRe: Datetime Pin
Christian Graus9-Feb-05 10:19
protectorChristian Graus9-Feb-05 10:19 
GeneralRe: Datetime Pin
Esmo20009-Feb-05 10:37
Esmo20009-Feb-05 10:37 
GeneralRe: Datetime Pin
Christian Graus9-Feb-05 10:45
protectorChristian Graus9-Feb-05 10:45 
GeneralResult Set Pin
Esmo20009-Feb-05 5:21
Esmo20009-Feb-05 5:21 
GeneralRe: Result Set Pin
Colin Angus Mackay9-Feb-05 6:02
Colin Angus Mackay9-Feb-05 6:02 
GeneralRe: Result Set Pin
Esmo20009-Feb-05 9:04
Esmo20009-Feb-05 9:04 
GeneralRe: Result Set Pin
Christian Graus9-Feb-05 10:49
protectorChristian Graus9-Feb-05 10:49 
GeneralViewing and editing several connected tables in a DataGrid Pin
j1hammer9-Feb-05 2:46
j1hammer9-Feb-05 2:46 
First some background:
I am working on a very big project in .NET. I have a client and server applications. I use ADO.NET to manage the data. The server is the only application which access the data source, and it passes the data to the clients using disconnected DataSets. The clients do not have access to the data source. So far I worked with DataGrids very easily, using several custom column styles.

My Problem:
My system engineer wants me to show in one grid columns from several connected tables (exactly like MS-Access queries, or SQL JOIN). What I mean is that I have two tables with a DataRelation defined between them (the child table contains a foriegn key of the parent table), and I want to view columns from both tables in the grid.
The requirement from the grid is that I will be able to edit fields of existing rows (adding new rows by the user is not done in the grid itself, so this feature I do not need). What I also need is that the columns will support custom ColumnStyle.

For Example: I have two tables ORDER and CUSTOMER, and the ORDER table contains a foriegn key CUSTOMER_ID, which is related to the ID field from CUSTOMER table. I want to show both ORDER_DATE (using a DateColumnStyle) and CUSTOMER_EMAIL (using EMAILColumnStyle). Both ColumnStyles are implemented and works perfectly with DataTables and DataViews.

I searched the internet for solutions, and realized that I cannot show in one grid columns from several DataTables. I can't apply SQL JOIN statements on DataSets (only on data sources, and using DataAdapters which I don't have in my clients). I almost gave up (I was quite surprised how little material there is on the subject, because it looks to me as this is a very simple feature and a must in data-oriented applications).

The only solution I found was the JoinView class from http://support.microsoft.com/kb/325682/EN-US/. I read about the limitations published on the site and tried the object. It works! As long as you want a ReadOnly view of the data. If you want to edit columns, only the main table (the child) can be edited - columns from other tables are read only (Which I guess I can live with, though I don't want to). But trying to apply custom ColumnStyles fails. Giving MappingNames to the ColumnStyles fails, and the grid still looks the same as before (without the ColumnStyles). As I said my custom ColumnStyles work for DataView.

Does anyone have a solution to the very common problem (using JoinView or not)of viewing to joined tables in a grid? Does anyone have actual exprerience with JoinView and can tell if it is any good?


GeneralDataGrid sorting Pin
Mr.Cooper9-Feb-05 0:38
Mr.Cooper9-Feb-05 0:38 
GeneralSQL Query Required ! Pin
Zishan Haider8-Feb-05 23:31
Zishan Haider8-Feb-05 23:31 
GeneralRe: SQL Query Required ! Pin
David Salter8-Feb-05 23:50
David Salter8-Feb-05 23:50 
GeneralRe: SQL Query Required ! Pin
Zishan Haider9-Feb-05 0:01
Zishan Haider9-Feb-05 0:01 
GeneralRe: SQL Query Required ! Pin
Mike Dimmick9-Feb-05 2:24
Mike Dimmick9-Feb-05 2:24 
GeneralRe: SQL Query Required ! Pin
Zishan Haider9-Feb-05 3:23
Zishan Haider9-Feb-05 3:23 
QuestionHow to set SAFEARRAY in CRecordset (ODBC) Pin
Anonymous8-Feb-05 10:10
Anonymous8-Feb-05 10:10 
GeneralNewbie Question Pin
Esmo20008-Feb-05 4:58
Esmo20008-Feb-05 4:58 
GeneralRe: Newbie Question Pin
Colin Angus Mackay8-Feb-05 6:21
Colin Angus Mackay8-Feb-05 6:21 
GeneralRe: Newbie Question Pin
Esmo20008-Feb-05 7:36
Esmo20008-Feb-05 7:36 
GeneralRe: Newbie Question Pin
Esmo20008-Feb-05 10:18
Esmo20008-Feb-05 10:18 
GeneralRe: Newbie Question Pin
Colin Angus Mackay8-Feb-05 11:39
Colin Angus Mackay8-Feb-05 11:39 
GeneralRe: Newbie Question Pin
Esmo20009-Feb-05 2:51
Esmo20009-Feb-05 2:51 
GeneralSPROC Input Parameters Pin
mav07077-Feb-05 14:29
mav07077-Feb-05 14:29 
GeneralRe: SPROC Input Parameters Pin
Colin Angus Mackay8-Feb-05 0:05
Colin Angus Mackay8-Feb-05 0:05 
GeneralRe: SPROC Input Parameters Pin
mav07078-Feb-05 2:28
mav07078-Feb-05 2:28 
GeneralDataTable Select Method Pin
numbrel7-Feb-05 14:15
numbrel7-Feb-05 14:15 

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.