Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:27am

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 360
1 Abhinav S 260
2 Nirav Prabtani 252
3 Dave Kreskowiak 155
4 Pikoh 140
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100