|
-
May 23rd, 2006, 03:38 AM
#1
Thread Starter
Just Married
[RESOLVED] Record count =-1 what’s problem
Hi all
Using coding I m saving a folder image into a table using field I (text)
It is saving successfully but when I m checking again it showing record count-1
What is the reason behind it
……………
help!!!!!!!!!!
code are
VB Code:
FileName1 = App.Path & "\QuesImages\Chemistry"
If text1.Text <> "" Then
Set f = Fs.GetFolder(FileName1)
Set fc = f.Files
For Each f1 In fc
S1 = S1 & f1.Name
S = "SELECT i FROM cheimage where i='" & Trim(S1) & "'"
Set R1 = Get_Special_Record_Set(S)
If R1.RecordCount = 0 Then
'showing record count=-1 here what is the reason HELP ME
MsgBox "Image " + S1 + " Not Found In Chemistry Folder ThereFore Restore Not Possible", vbInformation
S1 = ""
Exit Sub
End If
S1 = ""
Next
'Restoring The Folder
objFS.CopyFolder FileName1, text1.Text & "\QuesImages\Chemistry", True
End If
-
May 23rd, 2006, 03:54 AM
#2
Re: Record count =-1 what’s problem
The RecordCount property of a recordset is not implemented for all providers, cursortypes and cursorlocations. If it is not implemented, it will always return -1.
eg if you open a recordset by using the execute method of the connection, the RecordCount property will always return -1.
The RecordCount property is not the most accurate property, because even when it is implemented, it only give reliable results if the complete recordset has been loaded.
To check if the recordset returned results, use the EOF property.
If EOF is true directly after opening the recordset, the recordset is empty.
When the recordset is empty both EOF and BOF will be true.
Your code will look like this:
VB Code:
FileName1 = App.Path & "\QuesImages\Chemistry"
If text1.Text <> "" Then
Set f = Fs.GetFolder(FileName1)
Set fc = f.Files
For Each f1 In fc
S1 = S1 & f1.Name
S = "SELECT i FROM cheimage where i='" & Trim(S1) & "'"
Set R1 = Get_Special_Record_Set(S)
If R1.EOF and R1.BOF Then
MsgBox "Image " + S1 + " Not Found In Chemistry Folder ThereFore Restore Not Possible", vbInformation
S1 = ""
Exit Sub
End If
S1 = ""
Next
'Restoring The Folder
objFS.CopyFolder FileName1, text1.Text & "\QuesImages\Chemistry", True
End If
-
May 23rd, 2006, 04:01 AM
#3
Thread Starter
Just Married
Re: Record count =-1 what’s problem
If R1.EOF And R1.BOF Then
it showing eof false and bof also false but there is 1000 record in the table
-
May 23rd, 2006, 04:09 AM
#4
Thread Starter
Just Married
Re: Record count =-1 what’s problem
ya franc i get the point thanks a lot i m going to rate u
thanks a lot again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|