473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Records not updating

Hi there, I have a simple medical database with patient records. I use:
TotalRecords.Text = DetailsViewMain.DataItemCount & " records" to reflect
the number of patients in the db.
I then filter the records per person and update the count with the same
code. My problem is that the actual number of records is always off by one
update. That is to say that initially it reads correctly say 25 records.
Then I filter for person1 which has 3 records. The TotalRecords will read
25 the first time, then I filter for person2, which should read 4 but it
reads 3. Very strange! Any help with this?
Is there a way to cause an update/postback whatever to get the correct
number consistantly?

Thank you, Mark
May 7 '06 #1
3 1400
It appears that you are reading the DataItemCount property before the
filtering takes effect.

What do you use for data source, and what do you do to filter it?

Monty wrote:
Hi there, I have a simple medical database with patient records. I use:
TotalRecords.Text = DetailsViewMain.DataItemCount & " records" to reflect
the number of patients in the db.
I then filter the records per person and update the count with the same
code. My problem is that the actual number of records is always off by one
update. That is to say that initially it reads correctly say 25 records.
Then I filter for person1 which has 3 records. The TotalRecords will read
25 the first time, then I filter for person2, which should read 4 but it
reads 3. Very strange! Any help with this?
Is there a way to cause an update/postback whatever to get the correct
number consistantly?

Thank you, Mark

May 7 '06 #2
Hi, and thanks in advance.

* What do you use for data source, and what do you do to filter it?

Protected Sub ListBoxSelectRCP_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles
ListBoxSelectRCP.SelectedIndexChanged

If ListBoxSelectRCP.SelectedIndex + 1 = 1 Then
DetailsViewMain.DataSourceID = "roomFind1"
ListBoxSelectPatient.DataSourceID = "Patientfind1"
ListBoxSelectRoom.DataSourceID = "RoomFind1"
End If

If ListBoxSelectRCP.SelectedIndex + 1 = 2 Then
DetailsViewMain.DataSourceID = "roomFind2"
ListBoxSelectPatient.DataSourceID = "Patientfind2"
ListBoxSelectRoom.DataSourceID = "RoomFind2"
End If

TotalRecords.Text = DetailsViewMain.DataItemCount & " records"

End sub


"Göran Andersson" <gu***@guffa.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It appears that you are reading the DataItemCount property before the
filtering takes effect.

What do you use for data source, and what do you do to filter it?

Monty wrote:
Hi there, I have a simple medical database with patient records. I use:
TotalRecords.Text = DetailsViewMain.DataItemCount & " records" to reflect
the number of patients in the db.
I then filter the records per person and update the count with the same
code. My problem is that the actual number of records is always off by
one update. That is to say that initially it reads correctly say 25
records. Then I filter for person1 which has 3 records. The TotalRecords
will read 25 the first time, then I filter for person2, which should read
4 but it reads 3. Very strange! Any help with this?
Is there a way to cause an update/postback whatever to get the correct
number consistantly?

Thank you, Mark

May 7 '06 #3
Setting the DataSourceID property doesn't perform a DataBind, it only
set the RequiresDataBinding property. The data binding is done at some
later stage, probably when the control is going to be rendered and
detects that it needs data binding.

You either have to call DataBind yourself before getting DataItemCount,
or get it after the data binding occurs.

Monty wrote:
Hi, and thanks in advance.

* What do you use for data source, and what do you do to filter it?

Protected Sub ListBoxSelectRCP_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles
ListBoxSelectRCP.SelectedIndexChanged

If ListBoxSelectRCP.SelectedIndex + 1 = 1 Then
DetailsViewMain.DataSourceID = "roomFind1"
ListBoxSelectPatient.DataSourceID = "Patientfind1"
ListBoxSelectRoom.DataSourceID = "RoomFind1"
End If

If ListBoxSelectRCP.SelectedIndex + 1 = 2 Then
DetailsViewMain.DataSourceID = "roomFind2"
ListBoxSelectPatient.DataSourceID = "Patientfind2"
ListBoxSelectRoom.DataSourceID = "RoomFind2"
End If

TotalRecords.Text = DetailsViewMain.DataItemCount & " records"

End sub


"Göran Andersson" <gu***@guffa.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
It appears that you are reading the DataItemCount property before the
filtering takes effect.

What do you use for data source, and what do you do to filter it?

Monty wrote:
Hi there, I have a simple medical database with patient records. I use:
TotalRecords.Text = DetailsViewMain.DataItemCount & " records" to reflect
the number of patients in the db.
I then filter the records per person and update the count with the same
code. My problem is that the actual number of records is always off by
one update. That is to say that initially it reads correctly say 25
records. Then I filter for person1 which has 3 records. The TotalRecords
will read 25 the first time, then I filter for person2, which should read
4 but it reads 3. Very strange! Any help with this?
Is there a way to cause an update/postback whatever to get the correct
number consistantly?

Thank you, Mark


May 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hennie de Nooijer | last post by:
Hi, Currently we're a building a metadatadriven datawarehouse in SQL Server 2000. We're investigating the possibility of the updating tables with enormeous number of updates and insert and the...
28
by: Lee Rouse | last post by:
Hello all, This is going to be a rather lengthy "question". I have an Access 2k database, separated front end/back end. Front end copies are on about 30 workstations and used frequently during...
1
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass...
4
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
8
by: mantrid | last post by:
Hello Im having problems working out why the following code does not work. I dont think its the sql as the error occurs on the first update which ever one is put there ($q1 or $q2). Ive swapped...
2
by: najimou | last post by:
Hi I have a subform where the user make changes to several filtered records in view. when clicking the updating button, I run the update query to perform some calculations and update the table...
14
by: dancer | last post by:
Using ASP.net 1.1 2 QUESTIONS: 1. Why do my write commands not work? 2. This file successfully makes changes in the database record. There surely is some simple code I could add that would...
1
by: hilal84 | last post by:
Hi, I have a problem on updating some records on sql server 2005. I can update the records in the table apart from some records. Records are added to table by a .net application. When I try to...
5
by: Bill Schanks | last post by:
I have a winform app (VB 2005) that allows users to export data to excel, make updates to the excel file and import the data from that Excel file and update the database. My question is: Is it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.