Click here to Skip to main content
15,917,652 members
Home / Discussions / C#
   

C#

 
Generalabout dyndns Pin
Adoremi13-Jun-05 6:56
Adoremi13-Jun-05 6:56 
GeneralRe: about dyndns Pin
MoustafaS13-Jun-05 15:11
MoustafaS13-Jun-05 15:11 
GeneralRe: about dyndns Pin
eggie513-Jun-05 18:55
eggie513-Jun-05 18:55 
GeneralHelp understanding Pin
Tom Wright13-Jun-05 6:11
Tom Wright13-Jun-05 6:11 
GeneralRe: Help understanding Pin
S. Senthil Kumar13-Jun-05 6:27
S. Senthil Kumar13-Jun-05 6:27 
Generalvoice recording Pin
mhmoud rawas13-Jun-05 4:39
mhmoud rawas13-Jun-05 4:39 
GeneralRe: voice recording Pin
mav.northwind13-Jun-05 5:02
mav.northwind13-Jun-05 5:02 
Generaladding items to a list box using a dataset Pin
steve_rm13-Jun-05 4:37
steve_rm13-Jun-05 4:37 
Hello,

I have a 1 table with a list of departments, and another table with a list of employees who work in those departments.

What I want to do is select a department from a combo box, and display all the employees who work in that department in a list box.

I am using a dataset and created the data relationship between the 2 tables. My code is as follows:


OleDbCommand cmd = cnn.CreateCommand();<br />
			cmd.CommandType = CommandType.Text;<br />
			cmd.CommandText = "SELECT * FROM Employee";<br />
			da.SelectCommand = cmd;<br />
			da.FillSchema(ds,SchemaType.Source,"Employee");<br />
			da.Fill(ds,"Employee");<br />
<br />
			cmd.CommandText = "SELECT * FROM Department";<br />
			da.SelectCommand = cmd;<br />
			da.FillSchema(ds,SchemaType.Source,"Department");<br />
			da.Fill(ds,"Department");<br />
				<br />
			//Create the relationship for the employee and department tables<br />
			DataColumn parentColumn = ds.Tables["Department"].Columns["DepartmentCode"];<br />
			DataColumn childColumn = ds.Tables["Employee"].Columns["DepartmentID"];<br />
				<br />
			ds.Relations.Clear();<br />
			DataRelation drEmployees = new DataRelation("EmployeeDetails",parentColumn,childColumn);<br />
			ds.Relations.Add(drEmployees);<br />
<br />
//Use a for loop to add all the employees into a list box - have problem with this part<br />
foreach employee in departments<br />
   Add to the list box<br />

Many thanks in advance,

Steve
GeneralEnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 4:22
Joe_Huddleston13-Jun-05 4:22 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
steve_rm13-Jun-05 6:27
steve_rm13-Jun-05 6:27 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 7:06
Joe_Huddleston13-Jun-05 7:06 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Dave Kreskowiak13-Jun-05 8:41
mveDave Kreskowiak13-Jun-05 8:41 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston13-Jun-05 13:38
Joe_Huddleston13-Jun-05 13:38 
GeneralRe: EnableVisualStyles on a TabPage having a problem with some controls Pin
Joe_Huddleston14-Jun-05 0:58
Joe_Huddleston14-Jun-05 0:58 
GeneralSAP Modules into C#.Net Pin
Anonymous13-Jun-05 4:10
Anonymous13-Jun-05 4:10 
GeneralRe: SAP Modules into C#.Net Pin
Seraphin13-Jun-05 4:45
Seraphin13-Jun-05 4:45 
GeneralRe: SAP Modules into C#.Net Pin
Sneha Dehariya14-Jun-05 0:41
Sneha Dehariya14-Jun-05 0:41 
QuestionString.Format-ting floating point numbers, how? Pin
iliyang13-Jun-05 3:04
iliyang13-Jun-05 3:04 
AnswerRe: String.Format-ting floating point numbers, how? Pin
Seraphin13-Jun-05 3:09
Seraphin13-Jun-05 3:09 
GeneralRe: String.Format-ting floating point numbers, how? Pin
iliyang13-Jun-05 3:21
iliyang13-Jun-05 3:21 
GeneralReflection ... Call Method. Parameter question Pin
Seraphin13-Jun-05 2:57
Seraphin13-Jun-05 2:57 
GeneralRe: Reflection ... Call Method. Parameter question Pin
occcy13-Jun-05 4:07
occcy13-Jun-05 4:07 
GeneralRe: Reflection ... Call Method. Parameter question Pin
Seraphin13-Jun-05 4:45
Seraphin13-Jun-05 4:45 
GeneralSyntax error (missing operator) when deleting with commandbuilder Pin
Hawkmoth13-Jun-05 2:28
Hawkmoth13-Jun-05 2:28 
GeneralRe: Syntax error (missing operator) when deleting with commandbuilder Pin
Nick Parker13-Jun-05 2:56
protectorNick Parker13-Jun-05 2:56 

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.