Click here to Skip to main content
15,887,335 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:58
Emanuele Bonin24-Dec-15 9:58 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:55
Emanuele Bonin24-Dec-15 9:55 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz24-Dec-15 8:11
mveGerry Schmitz24-Dec-15 8:11 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 5:28
Emanuele Bonin26-Dec-15 5:28 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz26-Dec-15 7:43
mveGerry Schmitz26-Dec-15 7:43 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 8:40
Emanuele Bonin26-Dec-15 8:40 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz26-Dec-15 16:16
mveGerry Schmitz26-Dec-15 16:16 
QuestionFill DataGrid ODBC Postgres Pin
Andre Dieme22-Dec-15 23:04
Andre Dieme22-Dec-15 23:04 
Hello,
my problem is to fill a DataGrid in WPF C# Framework 4.0.

Code DataGrid.xaml:
C#
<Grid>
       <DataGrid ItemsSource="{Binding}"  AutoGenerateColumns="True" HorizontalAlignment="Stretch" Margin="0,0,2,2" Name="dataGrid1" VerticalAlignment="Stretch"  />
   </Grid>


Code Page.cs :
C#
  public Page2()
        {
            InitializeComponent();
            FillTable();
        }

        public class Lagerteile
        {
            public int ID { get; set; }
            public DateTime Liefertermin { get; set; }
            public string WANr { get; set; }
            public string Name { get; set; }
            public int Stk { get; set; }
            public string Kunde { get; set; }
            public string Pos { get; set; }
        }


        public void FillTable() {
 
            string cs = "Driver={PostgreSQL Unicode};" +
                        "Server=localhost;" +
                        "Database=***;" +
                        "Uid=***;" +
                        "Pwd=***;";
           
            
            string query = "SELECT *FROM xxxx";

            OdbcConnection cn = null;
            try
            {

                cn = new OdbcConnection(cs);
                DataContext context = new DataContext(cn);
                this.dataGrid1.DataContext = new ObservableCollection<Lagerteile>(
                context.ExecuteQuery<Lagerteile>(query));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

            if (cn.State == ConnectionState.Open)
            {
                cn.Close();
                cn.Dispose();

            }
}


The Database is PostgreSQL 9.4. General it works but it took about 4 seconds to load 100 rows and only 1 second more for 15.000 rows. Is there any possibilty to speed this up ?
AnswerRe: Fill DataGrid ODBC Postgres Pin
Eddy Vluggen23-Dec-15 1:51
professionalEddy Vluggen23-Dec-15 1:51 
AnswerRe: Fill DataGrid ODBC Postgres Pin
Mycroft Holmes23-Dec-15 11:53
professionalMycroft Holmes23-Dec-15 11:53 
GeneralRe: Fill DataGrid ODBC Postgres Pin
Andre Dieme25-Dec-15 10:31
Andre Dieme25-Dec-15 10:31 
QuestionWhy i can't change my startup Form in VS2013. Pin
Kashaf Murtaza22-Dec-15 22:18
Kashaf Murtaza22-Dec-15 22:18 
AnswerRe: Why i can't change my startup Form in VS2013. Pin
Pete O'Hanlon22-Dec-15 23:35
mvePete O'Hanlon22-Dec-15 23:35 
AnswerRe: Why i can't change my startup Form in VS2013. Pin
OriginalGriff22-Dec-15 23:37
mveOriginalGriff22-Dec-15 23:37 
AnswerRe: Why i can't change my startup Form in VS2013. Pin
John Torjo28-Dec-15 0:14
professionalJohn Torjo28-Dec-15 0:14 
Questioncompression Pin
jackie.398121-Dec-15 9:18
jackie.398121-Dec-15 9:18 
AnswerRe: compression Pin
Kevin Marois21-Dec-15 9:28
professionalKevin Marois21-Dec-15 9:28 
GeneralRe: compression Pin
jackie.398121-Dec-15 9:31
jackie.398121-Dec-15 9:31 
GeneralRe: compression Pin
Richard Andrew x6421-Dec-15 10:26
professionalRichard Andrew x6421-Dec-15 10:26 
AnswerRe: compression Pin
Dave Kreskowiak21-Dec-15 11:05
mveDave Kreskowiak21-Dec-15 11:05 
GeneralRe: compression Pin
jackie.398121-Dec-15 11:09
jackie.398121-Dec-15 11:09 
AnswerRe: compression Pin
Rob Philpott21-Dec-15 11:16
Rob Philpott21-Dec-15 11:16 
GeneralRe: compression Pin
jackie.398121-Dec-15 11:19
jackie.398121-Dec-15 11:19 
GeneralRe: compression Pin
Rob Philpott21-Dec-15 11:28
Rob Philpott21-Dec-15 11:28 
GeneralRe: compression Pin
jackie.398121-Dec-15 11:33
jackie.398121-Dec-15 11:33 

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.