Click here to Skip to main content
15,894,630 members
Home / Discussions / C#
   

C#

 
GeneralRe: Some Columns of DataGridView Wont Accept Values Pin
matt_1ca22-May-13 15:11
matt_1ca22-May-13 15:11 
QuestionTo Throw or Not To Throw Pin
Kevin Marois21-May-13 12:39
professionalKevin Marois21-May-13 12:39 
AnswerRe: To Throw or Not To Throw Pin
Garth J Lancaster21-May-13 13:19
professionalGarth J Lancaster21-May-13 13:19 
AnswerRe: To Throw or Not To Throw Pin
SledgeHammer0121-May-13 13:37
SledgeHammer0121-May-13 13:37 
GeneralRe: To Throw or Not To Throw Pin
Kevin Marois21-May-13 13:40
professionalKevin Marois21-May-13 13:40 
GeneralRe: To Throw or Not To Throw Pin
SledgeHammer0121-May-13 14:31
SledgeHammer0121-May-13 14:31 
AnswerRe: To Throw or Not To Throw Pin
SoMad21-May-13 13:55
professionalSoMad21-May-13 13:55 
AnswerRe: To Throw or Not To Throw Pin
PIEBALDconsult21-May-13 14:13
mvePIEBALDconsult21-May-13 14:13 
GeneralRe: To Throw or Not To Throw Pin
Eddy Vluggen21-May-13 22:29
professionalEddy Vluggen21-May-13 22:29 
AnswerRe: To Throw or Not To Throw Pin
Dave Kreskowiak21-May-13 14:29
mveDave Kreskowiak21-May-13 14:29 
GeneralRe: To Throw or Not To Throw Pin
PIEBALDconsult21-May-13 14:52
mvePIEBALDconsult21-May-13 14:52 
GeneralRe: To Throw or Not To Throw Pin
Keith Barrow22-May-13 2:20
professionalKeith Barrow22-May-13 2:20 
GeneralRe: To Throw or Not To Throw Pin
Dave Kreskowiak22-May-13 2:25
mveDave Kreskowiak22-May-13 2:25 
AnswerRe: To Throw or Not To Throw Pin
V.21-May-13 23:38
professionalV.21-May-13 23:38 
GeneralRe: To Throw or Not To Throw Pin
Eddy Vluggen22-May-13 0:30
professionalEddy Vluggen22-May-13 0:30 
GeneralRe: To Throw or Not To Throw Pin
V.22-May-13 0:38
professionalV.22-May-13 0:38 
GeneralRe: To Throw or Not To Throw Pin
Eddy Vluggen22-May-13 6:55
professionalEddy Vluggen22-May-13 6:55 
GeneralRe: To Throw or Not To Throw Pin
jschell22-May-13 8:25
jschell22-May-13 8:25 
AnswerRe: To Throw or Not To Throw Pin
jschell22-May-13 8:47
jschell22-May-13 8:47 
QuestionFaster way of filling a Dataset Pin
MumbleB21-May-13 8:17
MumbleB21-May-13 8:17 
Hi Guys. Suppose this question has been asked numerous times. I have a database "postgresql" with about 20 columns and about 1.4million records. I select data from the database between two given date ranges and it takes about 4 minutes to fill the dataset. I would like to speed this up. I am doing no updates, just using the data to compile a report. is there a faster way to do this? Below code is what I have. My results are OK but just filling the dataset is a bit of a problem i that it takes +- 4 to 5 minutes to fill the dataset.

C#
            string sql = @"SELECT * FROM datbase where bus_received_time_stamp between @startDate AND @endDate";

            //Making use of a Postgresql Connection helper
            NpgsqlConnection conn = new NpgsqlConnection(conns);

            //Here we format the dateTimePicker dates to be used with the database
            string fromDate = dtStartDate.Text;
            string toDate = dtEndDate.Text;

            //Instanciate a SqlCommand and connect to the DB and fill a Dataset
            NpgsqlCommand cmd = new NpgsqlCommand();
            cmd.Connection = conn;
            cmd.CommandText = sql;
            cmd.Parameters.AddWithValue("@startDate", fromDate + " 00:00:01");
            cmd.Parameters.AddWithValue("@endDate", toDate + " 23:59:59");

            #endregion

            conversionRate = txtConversionRate.Text;
            double conRate = Convert.ToDouble(conversionRate);

            try
            {
                //Open the DB Connection
                conn.Open();
                setText(this, "Connection Established");
                NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd);
                setText(this, "Collecting Data for Processing!");
                da.Fill(dts);
//Time between the two "setText statements takes a good 4 to 5 minutes
                setText(this, "Define Data To be Used");


From here the processing takes a few minutes as there quite a bit of matching to do etc. However the main thing here is that filling the DataAdapter takes too much time. I would like to cut this down to maybe a few seconds, maybe a minute? I have added an Index on the DB on the Datee column to try and speed things up but now sure if this is correct?

Any ideas??
Excellence is doing ordinary things extraordinarily well.

AnswerRe: Faster way of filling a Dataset Pin
Jasmine250121-May-13 9:29
Jasmine250121-May-13 9:29 
AnswerRe: Faster way of filling a Dataset Pin
SledgeHammer0121-May-13 11:30
SledgeHammer0121-May-13 11:30 
GeneralRe: Faster way of filling a Dataset Pin
Eddy Vluggen21-May-13 22:32
professionalEddy Vluggen21-May-13 22:32 
GeneralRe: Faster way of filling a Dataset Pin
SledgeHammer0122-May-13 4:48
SledgeHammer0122-May-13 4:48 
GeneralRe: Faster way of filling a Dataset Pin
Eddy Vluggen22-May-13 5:01
professionalEddy Vluggen22-May-13 5:01 

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.