Solved

RDO thingy, problem, hasell .......

Posted on 1998-05-08
6
205 Views
Last Modified: 2009-07-29
I've asked this question before, but with no avail. I would really like to know why I seem to be the only person getting this problem. My system is in production now with 250 users connected so I dont like having uncertainties in the program. So I would appreciate it if anybody can tell me whats going on.


Okay – I use a SQL server 6.5 db. I access the database through RDO.

Everything works fine (Almost)

I get a couple of records that when I access them (Look at their values) it works fine. When I try do it the second time I find the record has turned to NULL. Ie.

If I do this:

Debug.print RS!Record

Debug.print RS!Record
I will get this "Hello World" the first time and a null value the second.

Even if the statements are exactly after each other. I also use the default cursor.

Has anybody an Idea why I get this.

It was fairly easy work around the problem but I still would like to know why it happens and why only on two fields (Both is text (16)) .

Thnx in advance.

Acually I found it on some more tables now .....
I amolost think it has something to do with SQL .....
0
Comment
Question by:Veroland
6 Comments
 

Expert Comment

by:berlet
ID: 1444036
mögliche Ursachen wird behoben mit

IF ISNUL (Data.Recordset.Field("Feldname")) = False then ....

0
 
LVL 2

Author Comment

by:Veroland
ID: 1444037
Its only null the second time I access the record.
If i say isnull(rs!Record) 2 times I will get False then True
0
 
LVL 5

Expert Comment

by:bin_huwairib
ID: 1444038
Post your code, Veroland.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
lmorris earned 620 total points
ID: 1444039
This happens when you go against a text field without using the getchunk method. If you modify your program to retrieve the text field using getchunk, your problem will be cured! Here is a working example that uses SQL's pub database to demonstrate your problem, then shows you how to retrieve the field using the getchunk method.

    Dim en As rdoEnvironment
    Set en = rdoEnvironments("Default_Environment")
   
    Dim cn As rdoConnection
    Set cn = en.OpenConnection("", rdDriverNoPrompt, False, "DSN=LocalServer")
   
    Dim rs As rdoResultset
    Set rs = cn.OpenResultset("Select * From Pubs..Pub_Info", rdOpenKeyset)
   
    MsgBox "ISNull? " & IsNull(rs!pr_info)
    MsgBox "ISNull? " & IsNull(rs!pr_info)
   
    Dim strPRInfo As String
    strPRInfo = rs!pr_info.GetChunk(rs!pr_info.ColumnSize)
   
    MsgBox strPRInfo
   
    strPRInfo = rs!pr_info.GetChunk(rs!pr_info.ColumnSize)
   
    MsgBox strPRInfo
   
    rs.Close
    cn.Close
    en.Close

0
 
LVL 2

Author Comment

by:Veroland
ID: 1444040
What I really would like to know is why this happes.

But Hey, thanks - This question was posted on a lot of places for quite some time.
0
 
LVL 2

Expert Comment

by:lmorris
ID: 1444041
I don't know for sure, but my best guess would be pointer related. If you look at the GetChunk method, it has an offset property. I think when you do a rs!pr_info, it retrieves from 0 to ?. The next time it retrieves from ? to ?. You'll also notice, that if you move off the record, then back to it, you'll be able to retrieve the field again.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question