ADO and SEEK Crash (VB6)
- From: "Ree" <Ree@xxxxxxxxxx>
- Date: Sun, 28 Aug 2005 16:27:28 +0200
Hi All,
i've got a piece of cade made in VB 6. It doesn't work anymore under Xp SP2.
The software is loaded with rs.seek commands. Now the software crashes
under XP
I've added a sample of the code below. The code crashes after a few
iterations of the loop
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rsA As ADODB.Recordset
Dim rsP As ADODB.Recordset
Dim M As Long
Dim n As Long
Dim p1 As String
Dim SQL As String
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.jet.OLEDB.4.0; Data source=database.pp; Jet
OLEDB:Database Password=dsawertg;"
SQL = "SELECT * FROM Tabel1"
Set rsP = New ADODB.Recordset
rsP.CursorLocation = adUseClient
rsP.Open SQL, conn, adOpenStatic, adLockOptimistic, adCmdText
Set rsA = New ADODB.Recordset
rsA.Index = "LevelA"
rsA.Open "LevelA", conn, adOpenKeyset, adLockReadOnly, adCmdTableDirect
M = 100
Do While M > 0
M = M - 1
lblStatus.Caption = M
DoEvents
p1 = "a"
n = 5
Do While n > 0
n = n - 1
SQL = "SELECT * FROM Level5 ORDER BY ArticleNr_P"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open SQL, conn, adOpenStatic, adLockOptimistic, adCmdText
Do While Not rs.EOF
rsA.Seek rs!ArticleNr_P
'Debug.Print rs!ArticleNr_P
If Not rsA.EOF Then
rsP.AddNew
rsP!naam = p1
rsP.Update
End If
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Loop
Loop
lblStatus.Caption = "Klaar!"
Tabel1 bevat de velden Naam (String) en ID (Autonummering
Level5 bevat:
Articlenr_P as string
met de volgende waarden
01a11
02a11
03a11
04a11
05a11
06a11
07a11
08a11
09a11
10a11
90a11
LevelA bevat:
Articlenr as string
met de waarden
01a11
02a11
03a11
04a11
05a11
06a11
07a11
08a11
09a11
15a11
16a11
90a11
99a11
Does anyone also has this problem? What have I done wrong??
Cheers, Ray
.
- Prev by Date: What providers do pessimistic locking?
- Next by Date: SQL Logical Statement Problem
- Previous by thread: What providers do pessimistic locking?
- Next by thread: SQL Logical Statement Problem
- Index(es):
Relevant Pages
|
|