Click here to Skip to main content
Sign Up to vote bad
good
See more: C#WPF
private List<getWorkDetails> getWorkInfo(string WorkCenter, string Item)
        {
            List<getWorkDetails> x = new List<getWorkDetails>();
            string sqlGetTimes = "select start_date, completion_date, complete_quantity from dr_dc_schedule where is_complete = '1' and workcenter_id = '" + WorkCenter + "' and start_date > '" + startValue + "' and start_date < '" + endValue + "' and item_id = '" + Item + "' ";
            OracleCommand getTimes = new OracleCommand(sqlGetTimes, connShop);
            OracleDataReader readTimes1 = getTimes.ExecuteReader();
 
            using (readTimes1)
            {
                DataTable table = new DataTable();
                table.TableName = "Krysiaa"; // Apparantly I need a name to assign a table..
                table.Load(readTimes1);
                dvNewDataViewObject.Table = table;
            }
            readTimes1.Dispose();
 
            OracleDataReader readTimes2 = getTimes.ExecuteReader();
 
            TabItem t = new TabItem();
            t.Header = Item;
            t.Name = "itm" + Item;
            
            DataGrid dg = new DataGrid();
            dg.Name = "dg" + Item;
            dg.ItemsSource = dvNewDataViewObject;
            t.Content = dg;
 
            TabContAroundPerformGrid.Items.Insert((TabContAroundPerformGrid.Items.Count-1), t);
 
I have a function that does two things (bad I know). First, its responsibility is to return a List of getWorkDetails, which is a class of mine (poor naming :/ ). Secondly, it needs to pull data from an SQL statement, and add a tab to a tabcontrol of mine and insert a datagrid (with my sql pull info) into that tab.
 
The problem is, the tabs are created fine, with good headers. The problem is each tab has the same datagrid info! From the final SQL pull. Does anyone have any idea why the final sql pull is always showing up in ALL the tab controls?
 
If anyone has any ideas and needs further clarification. Let me know.
Posted 19 Feb '13 - 6:27


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 239
1 OriginalGriff 173
2 Maciej Los 135
3 Mahesh Bailwal 104
4 Aarti Meswania 98
0 Sergey Alexandrovich Kryukov 10,214
1 OriginalGriff 7,819
2 CPallini 4,181
3 Rohan Leuva 3,522
4 Maciej Los 3,089


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid