Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
'get all of the stop address details - move them into a in memory clone to stop it from going back to the database for each search later Dim stopAddressList = From s In db.stop_address_details Select s Dim searchAddressList = stopAddressList.ToArray searchAddressList.Clone DataGridView1.DataSource=stopAddressList.ToArray ' debug code - remove command.CommandText="select distinct on (customer_reference) customer_reference, stop_name, stop_address, actual_service_date, Actual_arrival_time, stop_signature " & _ "from cops_reporting.distribution_stop_information " & _ "where customer_no = '91000' and stop_signature <> '' and datetime_updated > '"& lastDatetimeUpdated & "' and datetime_updated < '" & endDate &"'" PgSqlConnection1.Open ' opens the connection to the postgresql server Label1.Text = "opening reader..." Using reader As PgSqlDataReader =command.ExecuteReader() Label1.Text = "starting" Application.DoEvents While reader.Read totalRecordCount +=1 Dim customerReferenceNo, stopName, recBy As String customerReferenceNo=reader.GetValue(0).ToString 'go see if this is one of the sites we are monitoring Dim searchfor = From f In searchAddressList Where f.customer_reference_no = customerReferenceNo Select f label1.text = totalRecordCount.ToString Label1.Update If searchfor.Count>0 ' found it, now see if we already have this POD in our database - the below code will be replaced with a more through routine stopName =reader.GetValue(1).ToString recBy=reader.GetValue(5).ToString Dim dateOfStop As Date = reader.GetValue(3) Dim timeOfStop As TimeSpan = reader.GetValue(4) Dim datetimeOfStop As Date = dateOfStop.Add(timeOfStop) foundRecordCount +=1 TextBox1.AppendText ("Stop at " & customerReferenceNo & " for " & stopName & " signed for by " & recBy & " at " & datetimeOfStop.ToString & " - " & timeOfStop.ToString & vbCrLf) End If End While Label1.Text = "record count: " & foundRecordCount & " out of " & totalRecordCount End Using PgSqlConnection1.Close
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.