Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can i store path of zipfile in DataBase MS-SQL Using C# 2.0 Pin
pmarfleet2-Mar-08 4:44
pmarfleet2-Mar-08 4:44 
GeneralRe: How can i store path of zipfile in DataBase MS-SQL Using C# 2.0 Pin
Christian Graus2-Mar-08 10:58
protectorChristian Graus2-Mar-08 10:58 
GeneralRe: How can i store path of zipfile in DataBase MS-SQL Using C# 2.0 Pin
Member 43708983-Mar-08 7:33
Member 43708983-Mar-08 7:33 
QuestionCalling WebMethods using Request XML? Pin
geekfromindia2-Mar-08 4:03
geekfromindia2-Mar-08 4:03 
AnswerRe: Calling WebMethods using Request XML? Pin
pmarfleet2-Mar-08 4:43
pmarfleet2-Mar-08 4:43 
GeneralRe: Calling WebMethods using Request XML? Pin
geekfromindia2-Mar-08 5:03
geekfromindia2-Mar-08 5:03 
GeneralRe: Calling WebMethods using Request XML? Pin
pmarfleet2-Mar-08 5:18
pmarfleet2-Mar-08 5:18 
QuestionMultiple relation not working as expected [modified] Pin
panda8692-Mar-08 3:40
panda8692-Mar-08 3:40 
Can someone please tell me if I'm approaching this incorrectly (and if so, suggest a better way) or tell me if I just can't do this at all?

I have 3 tables:

Table 1
tableOneID (PK)
displayString

Table 2
tableTwoID (PK)
displayString
tableOneID (FK)

Table 3

tableThreeID (PK)
displayString
tableTwoID (FK)

I want to be able to display the information in 3 combo boxes, filtered by the selection the 'upper' combo boxes. I have a dataset containing 3 datatables and have created relationships between the tables. It all works great for the first two combo boxes (cboTable_2's data is filtered correctly by selection in cboTable_1) but not for the next combo box - I want cboTable_3's data to be populated based on the selection in cboTable_2.

OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Table_1", conn);<br />
da.Fill(ds, "Table_1");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_2", conn);<br />
da.Fill(ds, "Table_2");<br />
<br />
da = new OleDbDataAdapter("SELECT * FROM Table_3", conn);<br />
da.Fill(ds, "Table_3");<br />
<br />
DataColumn masterOne = ds.Tables["Table_1"].Columns["tableOneID"];<br />
DataColumn childOne = ds.Tables["Table_2"].Columns["tableOneID"];<br />
DataRelation relation = new DataRelation("RelationMasterChild", masterOne, childOne);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_1.DataSource = ds;<br />
cboTable_1.DisplayMember = "Table_1.displayString";<br />
cboTable_1.ValueMember = "Table_1.tableOneID";<br />
<br />
cboTable_2.Datasource = ds;<br />
cboTable_2.DisplayMember = "Table_1.RelationMasterChild.displayString";<br />
cboTable_2.ValueMember = "Table_1.RelationMasterChild.tableTwoID";<br />
<br />
// Now I would assume that I can connect tables 2 and 3 in the same way<br />
DataColumn masterTwo = ds.Tables["Table_2"].Columns["tableTwoID"];<br />
DataColumn childTwo = ds.Tables["Table_3"].Columns["tableTwoID"];<br />
relation = new DataRelation("RelationChildChild", masterTwo, childTwo);<br />
ds.Relations.Add(relation);<br />
<br />
cboTable_3.Datasource = ds;<br />
cboTable_3.DisplayMember = "Table_2.RelationChildChild.displayString";<br />
cboTable_3.ValueMember = "Table_2.RelationChildChild.tableThreeID";


The problem: On load this data is displayed correctly
cboTable_1 filters data in cboTable_2 which in turn filters data in cboTable_3
but when cboTable_1 and/or cboTable_2 selection is changed, cboTable_3 is not updated

Thanks for any input.

modified on Sunday, March 2, 2008 11:17 AM

Generalconvert structure to IntPtr Pin
amirreza_nl2-Mar-08 3:35
amirreza_nl2-Mar-08 3:35 
GeneralRe: convert structure to IntPtr Pin
amirreza_nl2-Mar-08 19:37
amirreza_nl2-Mar-08 19:37 
GeneralRe: convert structure to IntPtr Pin
DaveyM692-Mar-08 23:27
professionalDaveyM692-Mar-08 23:27 
GeneralRe: convert structure to IntPtr Pin
amirreza_nl3-Mar-08 4:36
amirreza_nl3-Mar-08 4:36 
GeneralRe: convert structure to IntPtr Pin
DaveyM693-Mar-08 9:11
professionalDaveyM693-Mar-08 9:11 
GeneralRe: convert structure to IntPtr [modified] Pin
amirreza_nl6-Mar-08 6:05
amirreza_nl6-Mar-08 6:05 
AnswerRe: convert structure to IntPtr Pin
Martin Cook6-Mar-08 10:17
professionalMartin Cook6-Mar-08 10:17 
GeneralRe: convert structure to IntPtr Pin
amirreza_nl6-Mar-08 22:59
amirreza_nl6-Mar-08 22:59 
GeneralRe: convert structure to IntPtr Pin
amirreza_nl6-Mar-08 23:15
amirreza_nl6-Mar-08 23:15 
QuestionHelp me ! Pin
banghv2-Mar-08 0:37
banghv2-Mar-08 0:37 
GeneralRe: Help me ! Pin
Not Active2-Mar-08 3:27
mentorNot Active2-Mar-08 3:27 
GeneralRe: Help me ! Pin
banghv2-Mar-08 14:34
banghv2-Mar-08 14:34 
QuestionHow to open a file in the application using openFileDialog Pin
Walaza2-Mar-08 0:24
Walaza2-Mar-08 0:24 
AnswerRe: How to open a file in the application using openFileDialog Pin
buchstaben2-Mar-08 2:45
buchstaben2-Mar-08 2:45 
AnswerRe: How to open a file in the application using openFileDialog Pin
Walaza2-Mar-08 4:54
Walaza2-Mar-08 4:54 
AnswerRe: How to open a file in the application using openFileDialog Pin
Xmen Real 2-Mar-08 6:39
professional Xmen Real 2-Mar-08 6:39 
GeneralRe: How to open a file in the application using openFileDialog Pin
Walaza2-Mar-08 6:54
Walaza2-Mar-08 6:54 

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.