|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Hi Guys/Gals hope you can help me on this one. I'm maintaining a POS System which my former collegues of mine developed, where in some forms they use a ADO Data Control to connect to the database with no problems. The issue is that when I run the program, the Data Control is disabled, and querying the recordcount property reveals that it has no records in it. This problem (i think) occured when i installed the visual studio service pack 6. I tried uninstalling and reinstalling VB 6 but with no positive results, i tried to downgrade the MDAC to a lower version but it still does not work .
Any help on this one would be greatly appreciated, thnx. |
|
#2
|
|||
|
|||
|
Hi,
The recordcount property is a very weird property. It is not always initialized, and will sometimes display an incorrect number of records. It all depends on several factors (Provider, Cursortype and Cursorlocation). If you say that the recordcount is 0, does the recordset indeed contain no records? To make sure that a recordset is properly populated, use two move commands. First one to move to the last record of the set, and the other to move to the first record in the set. That should update the recordcount with correct value. The following code excerpt will tell you if the recordcount property is supported: Code:
If (rsObject.Supports(adApproxPosition)) OR (rsObject.Supports(adBookmark)) then msgbox "Recordset supports the use of .RecordCount", vbOkOnly + vbInformation, "Sample - Message" Else msgbox "Recordset does not support the use of .Recordcount." & vbCrLf & _ "Using .RecordCount drains resources, because the provider" & vbCrLf & _ "has to retrieve and count all the records (not very accurate).", _ vbOkOnly + vbInformation, _ "Sample - Message" End If Downgrading your version of the MDAC has no effect. ADO downgrades or upgrades on its own (taken you did not take steps to prevent that from happening). When I have a problem like this, especially with inherited code, I always look for the SQL statement and execute that on the database itself. Most likely you got a case of code-rot, and some field has a value that isn't right or some constructs used in the code are no longer valid. Hope this is of some help, if not please forgive me. If you got more questions, feel free to ask them. Grtz.© M. |
|
#3
|
|||
|
|||
|
Quote:
Thnx very much for the reply, tested the recordset with the code you gave, and it indeed supports the recordcount property, and further testing i did was to put simple datacontrol side- by-side with the existing ADODC, and guess what, the normal datacontol gets populated while the ADODC does not. well, thanks for the effort, anyways, still searching for an answer, thnx again. |
|
#4
|
|||
|
|||
|
Hi,
If you made a new ADODC connection and that one works, we might be able to see where the error is by comparing settings on both datacontrols. Things you might want to compare on the recordset are cursorlocation and cursortype. On the dataconnection you might want to check database connection settings like usernames and passwords, database locations and (in the case of SQL Server) client protocol settings. These settings can interrupt the retrieval of data. If all else fails, you might want to swap the old defunct datacontrol for the new functional datacontrol. Sometimes MS works in mysterious ways, and you might have a case of "Uncle Billy's joke". Grtz.© M. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Odd Problem with the ADO DataControl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|