Click here to Skip to main content
15,921,463 members
Home / Discussions / C#
   

C#

 
GeneralRe: Recursion to find an XML element Pin
Steven D. Foster30-Dec-08 16:12
Steven D. Foster30-Dec-08 16:12 
GeneralRe: Recursion to find an XML element Pin
Not Active30-Dec-08 16:33
mentorNot Active30-Dec-08 16:33 
GeneralRe: Recursion to find an XML element Pin
Steven D. Foster31-Dec-08 4:14
Steven D. Foster31-Dec-08 4:14 
AnswerRe: Recursion to find an XML element Pin
Steven D. Foster30-Dec-08 16:55
Steven D. Foster30-Dec-08 16:55 
AnswerRe: Recursion to find an XML element Pin
Christian Graus30-Dec-08 18:01
protectorChristian Graus30-Dec-08 18:01 
GeneralRe: Recursion to find an XML element Pin
Steven D. Foster31-Dec-08 4:07
Steven D. Foster31-Dec-08 4:07 
AnswerRecursion = BAD to find an XML element Pin
Steven D. Foster31-Dec-08 4:45
Steven D. Foster31-Dec-08 4:45 
QuestionHow do i go about this... do i create a DataBind / DataSet ??? [modified] Pin
cobalt-rose30-Dec-08 12:02
cobalt-rose30-Dec-08 12:02 
Hello i have altered my method of displaying my data since my last post and instead of a listview i am now using a datagrid as i thought it would be easier to use for what i want.

I now am stuck in terms of i do not have a clue how i am going to display the rest of the data from my table?

What i need to have is when the user clicks on a row of data e.g. 'client' all records are show in the tabbed page area?

(the picture will help to explain bettter)

Picture :


I have used a dataset to show the data when client is clicked but i dont think i can use that same dataset as it only retrieves four recods.

How can i have the four records displayed on one side of the page and then when highlighted display all infomation about the client in the seperat tabbed area?

My Code so far which displays client (when clicked) and contractor (when clicked)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace Deroche_Consultants
{
	public partial class main_screen : Form
	{
		string dataCategory = null;
		DataSet myDataSet;

		public main_screen()
		
		{
			InitializeComponent();	  
		}

		private void client_pic_Click(object sender, EventArgs e)
			{
				ClientDataLoad();
			}

		private void client_label_Click(object sender, EventArgs e)
			{
				ClientDataLoad();
			}

		private void client_buttonBox_Click(object sender, EventArgs e)
			{
				ClientDataLoad();
			}

		private void ClientDataLoad()
		{
		   // string dataCategory = client;
			string connectionString = "Data Source=localhost" + "; Database=_consultants" + "; User ID=root" + "; Password=password;";
			MySqlConnection MySqlConn = new MySqlConnection(connectionString);
			string strSQL = ("SELECT company_id, company_name, contact_fname, contact_sname, employee_count FROM client");
			MySqlCommand mysqlCommand = new MySqlCommand(strSQL, MySqlConn);
			MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(mysqlCommand);
			try
				{
					MySqlConn.Open();
					DataSet myDataSet = new DataSet();
					myDataSet.Clear();
					myDataAdapter.Fill(myDataSet, "client");
					dataGridView1.AutoGenerateColumns = true;
					dataGridView1.DataSource = myDataSet.Tables[0];
					MySqlConn.Close();
				}

			catch (Exception ex)
				{ 
					MessageBox.Show("Data Load Error "+ex.Message.ToString(),
					"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
					MySqlConn.Close();
				}
		}

		private void job_pic_Click(object sender, EventArgs e)
		{
		}

		private void job_label_Click(object sender, EventArgs e)
		{
		}

		private void job_boxButtons_Click(object sender, EventArgs e)
		{
		}
		//====================================== Contractor ======================================//

		private void contractor_pic_Click(object sender, EventArgs e)
			{
				ContractorDataLoad();
			}

		private void contractor_label_Click(object sender, EventArgs e)
			{
				ContractorDataLoad();
			}

		private void contractor_boxButton_Click(object sender, EventArgs e)
			{
				ContractorDataLoad();
			}

		private void ContractorDataLoad()
			{
			   // string dataCategory = contractor;
				string connectionString = "Data Source=localhost" + "; Database=_consultants" + "; User ID=root" + "; Password=password;";
				MySqlConnection MySqlConn = new MySqlConnection(connectionString);
				string strSQL = ("SELECT contractor_id, forename, surname, availability, daily_cost FROM contractor");
				MySqlCommand mysqlCommand = new MySqlCommand(strSQL, MySqlConn);
				MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(mysqlCommand); 
			try
				{
					MySqlConn.Open();
					DataSet myDataSet = new DataSet();
					myDataSet.Clear();
					myDataAdapter.Fill(myDataSet, "contractor");
					myDataAdapter.Fill(myDataSet);
					dataGridView1.AutoGenerateColumns = true;
					dataGridView1.DataSource = myDataSet.Tables[0];
					MySqlConn.Close();
				}
				catch (Exception ex)
					{ 
						MessageBox.Show("Data Load Error "+ex.Message.ToString(),
						"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
						MySqlConn.Close();
					}
			}
		private void button1_Click(object sender, EventArgs e)
		{
			Form2 addclient = new Form2();
			addclient.Show();
		}

		private void button3_Click(object sender, EventArgs e)
		{
		}
}
}

Thanks in advance,
C~Rose



modified on Wednesday, December 31, 2008 4:36 AM

AnswerRe: How do i go about this... do i create a DataBind / DataSet ??? Pin
Not Active30-Dec-08 13:23
mentorNot Active30-Dec-08 13:23 
AnswerRe: How do i go about this... do i create a DataBind / DataSet ??? Pin
Mycroft Holmes30-Dec-08 14:45
professionalMycroft Holmes30-Dec-08 14:45 
GeneralRe: How do i go about this... do i create a DataBind / DataSet ??? Pin
cobalt-rose1-Jan-09 13:25
cobalt-rose1-Jan-09 13:25 
QuestionApp.config Pin
s196675m30-Dec-08 11:34
s196675m30-Dec-08 11:34 
AnswerRe: App.config Pin
vaghelabhavesh30-Dec-08 13:08
vaghelabhavesh30-Dec-08 13:08 
QuestionDesign time collection problem Pin
kanchoette30-Dec-08 10:16
kanchoette30-Dec-08 10:16 
AnswerRe: Design time collection problem Pin
Wendelius30-Dec-08 10:44
mentorWendelius30-Dec-08 10:44 
GeneralRe: Design time collection problem Pin
kanchoette30-Dec-08 11:28
kanchoette30-Dec-08 11:28 
GeneralRe: Design time collection problem Pin
Wendelius30-Dec-08 11:41
mentorWendelius30-Dec-08 11:41 
GeneralRe: Design time collection problem Pin
kanchoette30-Dec-08 11:51
kanchoette30-Dec-08 11:51 
GeneralRe: Design time collection problem Pin
Wendelius30-Dec-08 11:56
mentorWendelius30-Dec-08 11:56 
QuestionReceiving Email prob using c# Pin
Abdul Rahman Hamidy30-Dec-08 9:20
Abdul Rahman Hamidy30-Dec-08 9:20 
AnswerRe: Receiving Email prob using c# Pin
EliottA30-Dec-08 14:27
EliottA30-Dec-08 14:27 
GeneralRe: Receiving Email prob using c# Pin
Abdul Rahman Hamidy30-Dec-08 15:05
Abdul Rahman Hamidy30-Dec-08 15:05 
GeneralRe: Receiving Email prob using c# Pin
Christian Graus30-Dec-08 18:02
protectorChristian Graus30-Dec-08 18:02 
GeneralRe: Receiving Email prob using c# Pin
Abdul Rahman Hamidy30-Dec-08 18:44
Abdul Rahman Hamidy30-Dec-08 18:44 
QuestionHow to find/replace a hard coded connection string in a binary file? Pin
Ryan Neil Shaw30-Dec-08 7:43
Ryan Neil Shaw30-Dec-08 7:43 

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.