I face a problem, please help.
Error I hit when there are three combobox.
Please refer the code with italic characters. this.comboBox1.DataSource = this.dataSet11.Tables["PANEL"];
this.comboBox2.DataSource = this.dataSet11.Tables["PANEL"].DefaultView;
this.comboBox3.DataSource = dataSet11.Tables["PANEL"];[/
The combobox1 value is as same as combobox3 value.
The combobox2 value is different because Table[""].DefaultView is added.
where combobox1,2,3 values are different at all.
BindingManagerBase bindManager1;
BindingManagerBase bindManager2;
BindingManagerBase bindManager3;
BindingManagerBase bindManager4;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cn1 = new OracleConnection(strConn);
using (cn1)
{
cn1.Open();
//da1 = new OracleDataAdapter("SELECT CLIENTGRPNO, DESCRIPTION, OTHERDESC, PANELCODE, INCLUDEBANDED, BANDEDFLAG, OFFERITEM, OUTPUTDIR, CAUSALPANELCODE, AUDITPANELCODE, MBDTAG_ATTRNO FROM RRS.CLIENT_GROUP_MASTER ORDER BY CLIENTGRPNO", cn1);
da1 = new OracleDataAdapter("SELECT CLIENTGRPNO, DESCRIPTION, OTHERDESC, OUTPUTDIR, PANELCODE, CAUSALPANELCODE, AUDITPANELCODE FROM RRS.CLIENT_GROUP_MASTER ORDER BY CLIENTGRPNO", cn1);
da1.Fill(this.dataSet11, "CLIENT_GROUP_MASTER");
da2 = new OracleDataAdapter("SELECT CLIENTGRPNO, CLIENTCODE FROM RRS.CLIENT_GROUP_DETAIL ORDER BY CLIENTGRPNO", cn1);
da2.Fill(this.dataSet11, "CLIENT_GROUP_DETAIL");
da3 = new OracleDataAdapter("SELECT CLIENTCODE, CLIENTNAME FROM RRS.CLIENT_MASTER ORDER BY CLIENTCODE", cn1);
da3.Fill(this.dataSet11, "CLIENT_MASTER");
da4 = new OracleDataAdapter("SELECT PANELCODE, DESCRIPTION FROM RRS.PANEL ORDER BY PANELCODE", cn1);
da4.Fill(this.dataSet11, "PANEL");
}
this.comboBox1.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION");
this.comboBox2.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION");
this.comboBox3.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION"); this.comboBox1.DataSource = null;
this.comboBox1.DisplayMember = "DESCRIPTION";
this.comboBox1.ValueMember = "PANELCODE";
this.comboBox1.DataSource = this.dataSet11.Tables["PANEL"];
this.comboBox2.DataSource = null;
this.comboBox2.DisplayMember = "DESCRIPTION";
this.comboBox2.ValueMember = "PANELCODE";
this.comboBox2.DataSource = this.dataSet11.Tables["PANEL"].DefaultView;
this.comboBox3.DataSource = null;
this.comboBox3.DisplayMember = "DESCRIPTION";
this.comboBox3.ValueMember = "PANELCODE";
this.comboBox3.DataSource = dataSet11.Tables["PANEL"];
this.bindManager1 = this.BindingContext[this.dataSet11, "CLIENT_GROUP_MASTER"];
this.bindManager2 = this.BindingContext[this.dataSet11, "CLIENT_GROUP_DETAIL"];
this.bindManager3 = this.BindingContext[this.dataSet11, "CLIENT_MASTER"];
this.bindManager4 = this.BindingContext[this.dataSet11, "PANEL"];
Binding b1 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_Panel.DESCRIPTIO N");
this.comboBox1.DataBindings.Add(b1);
Binding b2 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_CausalPanel.DESCRIPT ION");
this.comboBox2.DataBindings.Add(b2);
Binding b3 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_AuditPanel.DESCRIPTI ON");
this.comboBox3.DataBindings.Add(b3);
}
2 2464
Hi All,
Regarding the problem I mentioned in post #1, I still need to explain the code I paste in #1.
I use vs2005 wizard to generate four tables in one dataset --"dataSet11" :
1. CLIENT_GROUP_MASTER
2. CLIENT_GROUP_DETAIL
3. CLIENT_MASTER
4. PANEL
and its relation:
Table 1.-> Table 2. = CGMaster_CGDetail (PK = ClientGrpNo, FK = ClientGrpNo)
Table 2.-> Table 3. = CGDetail_CMaster (PK = ClientCode, FK = ClientCode)
Table 1.-> Table 4. = CGMaster_Panel, CGMaster_CausalPanel, CGMaster_AuditPanel.
(PK = panelcode, FK = panelcode)
(PK = causalpanelcode, FK = panelcode)
(PK = auditpanelcode, FK = panelcode)
Besides the explanation, I still have 1 more question.
What should I do if I want to implement master-detail feature into DataGridView:
I prefer to add the code as shown below before "private void Form1_Load(object sender, EventArgs e)" closed:
WHEN I ADD THE CODE BELOW, it works, result as my expected:
this.dataGridView1.DataSource = this.dataSet11.Tables["CLIENT_GROUP_MASTER"];
this.dataGridView1.DataMember = "CGMaster_CGDetail";
BUT, WHEN I ADD THE CODE BELOW, no joy:
this.dataGridView2.DataSource = this.dataSet11;
this.dataGridView2.DataMember = "CLIENT_GROUP_DETAIL.CGDetail_CMaster ";
Thanks all.
Regards,
einsson
I face a problem, please help.
Error I hit when there are three combobox.
Please refer the code with italic characters. this.comboBox1.DataSource = this.dataSet11.Tables["PANEL"];
this.comboBox2.DataSource = this.dataSet11.Tables["PANEL"].DefaultView;
this.comboBox3.DataSource = dataSet11.Tables["PANEL"];[/
The combobox1 value is as same as combobox3 value.
The combobox2 value is different because Table[""].DefaultView is added.
where combobox1,2,3 values are different at all.
BindingManagerBase bindManager1;
BindingManagerBase bindManager2;
BindingManagerBase bindManager3;
BindingManagerBase bindManager4;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
cn1 = new OracleConnection(strConn);
using (cn1)
{
cn1.Open();
//da1 = new OracleDataAdapter("SELECT CLIENTGRPNO, DESCRIPTION, OTHERDESC, PANELCODE, INCLUDEBANDED, BANDEDFLAG, OFFERITEM, OUTPUTDIR, CAUSALPANELCODE, AUDITPANELCODE, MBDTAG_ATTRNO FROM RRS.CLIENT_GROUP_MASTER ORDER BY CLIENTGRPNO", cn1);
da1 = new OracleDataAdapter("SELECT CLIENTGRPNO, DESCRIPTION, OTHERDESC, OUTPUTDIR, PANELCODE, CAUSALPANELCODE, AUDITPANELCODE FROM RRS.CLIENT_GROUP_MASTER ORDER BY CLIENTGRPNO", cn1);
da1.Fill(this.dataSet11, "CLIENT_GROUP_MASTER");
da2 = new OracleDataAdapter("SELECT CLIENTGRPNO, CLIENTCODE FROM RRS.CLIENT_GROUP_DETAIL ORDER BY CLIENTGRPNO", cn1);
da2.Fill(this.dataSet11, "CLIENT_GROUP_DETAIL");
da3 = new OracleDataAdapter("SELECT CLIENTCODE, CLIENTNAME FROM RRS.CLIENT_MASTER ORDER BY CLIENTCODE", cn1);
da3.Fill(this.dataSet11, "CLIENT_MASTER");
da4 = new OracleDataAdapter("SELECT PANELCODE, DESCRIPTION FROM RRS.PANEL ORDER BY PANELCODE", cn1);
da4.Fill(this.dataSet11, "PANEL");
}
this.comboBox1.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION");
this.comboBox2.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION");
this.comboBox3.DataBindings.Add("SelectedValue", ds, "PANEL.DESCRIPTION"); this.comboBox1.DataSource = null;
this.comboBox1.DisplayMember = "DESCRIPTION";
this.comboBox1.ValueMember = "PANELCODE";
this.comboBox1.DataSource = this.dataSet11.Tables["PANEL"];
this.comboBox2.DataSource = null;
this.comboBox2.DisplayMember = "DESCRIPTION";
this.comboBox2.ValueMember = "PANELCODE";
this.comboBox2.DataSource = this.dataSet11.Tables["PANEL"].DefaultView;
this.comboBox3.DataSource = null;
this.comboBox3.DisplayMember = "DESCRIPTION";
this.comboBox3.ValueMember = "PANELCODE";
this.comboBox3.DataSource = dataSet11.Tables["PANEL"];
this.bindManager1 = this.BindingContext[this.dataSet11, "CLIENT_GROUP_MASTER"];
this.bindManager2 = this.BindingContext[this.dataSet11, "CLIENT_GROUP_DETAIL"];
this.bindManager3 = this.BindingContext[this.dataSet11, "CLIENT_MASTER"];
this.bindManager4 = this.BindingContext[this.dataSet11, "PANEL"];
Binding b1 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_Panel.DESCRIPTIO N");
this.comboBox1.DataBindings.Add(b1);
Binding b2 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_CausalPanel.DESCRIPT ION");
this.comboBox2.DataBindings.Add(b2);
Binding b3 = new Binding("Text", dataSet11, "CLIENT_GROUP_MASTER.CGMaster_AuditPanel.DESCRIPTI ON");
this.comboBox3.DataBindings.Add(b3);
}
Since The dataset11.Table["Panel"] cannot support on more than two combobox objects, create another new Table --eg. dataset11.Table["Panel1"] can solve the problem .... althought this is not the best answer but alternative answer ....
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dica |
last post by:
i've got a dataSet that looks like the following:
<tblTasks>
<id>0</id>
<summary>-- Select A Task--</summary>
</tblTasks>
|
by: dtblankenship |
last post by:
Hello everyone,
I know this question has been asked many times in the forums, and after
spending a few days reading, I am still confused as to the answer.
I have a ListBox (lstBox),...
|
by: Dany P. Wu |
last post by:
Hi everyone,
As usual, weekend is tinkering time for students and I'm playing with
combobox databinding for the first time. Previously I have always iterated
through the records and added each...
|
by: virlinz |
last post by:
Hello
I'm a newbie who has a problem with updating the dataset into the
database. Maybe I missed a few lines of codes. Please shed some light
for me. The following code is working but not like I...
|
by: Eric A. Johnson |
last post by:
Hi Everyone,
I am at my wit's end here. I have a combobox (combyQueryTitle) that I
need to use in order to select a query for my database project. Therefore,
I am using the...
|
by: Dan Slaby |
last post by:
I have a webservice that I want to populate a combobox on a windows form.
The webservice creates the correct XML output, but when I attempt to bind it
to a combobox I get this error:
Additional...
|
by: Peter M. |
last post by:
I'm struggling with combobox databinding with something I consider a bug...
I'm binding my combobox to an array of structs. The struct exposes two
public properties, ID and Name, to be used as...
|
by: |
last post by:
I am sure this has been asked and answered, but here goes anyway...
VS.Net 2005, VB.Net
How can you display more than one field in the displaymember property of a
combobox inside the...
|
by: Gerrit |
last post by:
Hi,
I try to learn programming in c# with databinding controls. Now I have a
problem with a ComboBox with the advanced properties for databinding, I
want to set the DataSourceUpdateMode to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |