Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Please Help Debug
Message
De
04/01/2001 17:28:43
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Please Help Debug
Divers
Thread ID:
00459589
Message ID:
00459589
Vues:
41
I'm new to Visual Basic and have inherited a project in VB 5.0

Here is one of the functions that is giving me fits



Private Function InsertPVRValue(ByVal tcInsertString As String, _
ByVal tcRecType As String, _
ByVal tcName As String, _
ByVal tcValue As String, _
ByVal dbsPVR_pos As Database)
Dim pcSQL As String
Dim recPVR_pos As Recordset
pcSQL = "SELECT " & _
"FR_PVR.position, FR_PVR.length, FR_PVR.value " & _
"FROM FR_PVR " & _
"WHERE FR_PVR.rectype= '" & tcRecType & "' " & _
"AND FR_PVR.name= '" & tcName & "'"
Set recPVR_pos = dbsPVR_pos.OpenRecordset(pcSQL, dbOpenSnapshot, dbReadOnly)
If recPVR_pos.RecordCount = 0 Then
MsgBox "Record not found in FR_PVR" & vbCr & _
"rectype= " & tcRecType & vbCr & _
"name= " & tcName & vbCr & _
"In: modPVRTransfer-InsertPVRValue()"
Else
Mid(tcInsertString, recPVR_pos.Fields("position").Value, recPVR_pos.Fields("length").Value) = tcValue
End If
recPVR_pos.Close
InsertPVRValue = tcInsertString
End Function



The program opens a FoxPro 2.6 table (FR_PVR) and tries to get a record from it. The pcSQL variable the first time this is called translates to


pcSQL = "SELECT FR_PVR.position, FR_PVR.length, FR_PVR.value " & _
"FROM FR_PVR " & _
"WHERE FR_PVR.rectype= 'A'" & _
"AND FR_PVR.name= 'recid'"


When the "Set recPVR_pos" statement is issued no records are retrieved even though the expected record is in the table.

I can change the code to

pcSQL = "SELECT FR_PVR.position, FR_PVR.length, FR_PVR.value " & _
"FROM FR_PVR " & _
"WHERE FR_PVR.rectype= 'Z'" & _
"AND FR_PVR.name= 'recid'"


and find that record. Searching for any other RecType yields no results. If I simply SELECT * FROM FR_PVR I will get the entire record set. I've gone so far as to completely rebuild the Fox tables and index with the same results.

Any help at all will be greatly appreciated..........Rich
Répondre
Fil
Voir

Click here to load this message in the networking platform