Loosing connection to MS SQL Server text field

Posted on 2002-07-03
Medium Priority
Last Modified: 2010-05-02
Basics:  VB6 sp5 on W/2000

In my app I am reading a MS SQL Server table that contains a text field.  When I access the field for the first time, I can see the data, however, when I access the field the second time, I get a null.  It is as if I loose access to the text field after I first touch it.

For example,

If rsTable1.Fields("TextField") > "" Then
   X = rsTable1.Fields("TextField")
   X = ""
End If

In the above code, X always returns a null when there is something in rsTable1.Fields("TextField").

Thanks for the help
Question by:EYoung
  • 2
LVL 47

Accepted Solution

aikimark earned 100 total points
ID: 7127805
If IsNull(rsTable1.Fields("TextField").Value) Then
  X = ""
  X = rsTable1.Fields("TextField").Value
End If

Also, for the sake of debugging try:
Debug.Print rsTable1.Fields("TextField").Value
Debug.Print rsTable1.Fields("TextField").Value

prior to your If statement.

What data access method are you using?

Author Comment

ID: 7127862
I am using ADODB.Connection and ADODB.Recordset.

I will not be able to test this until next Wednesday as the code is at a client's location and I won't be there until then.

Tried using the IsNull() at the client's offices yesterday but that did not make any difference.

Not able to replicate the problem here at this office. Not sure why.  Will keep you posted.
LVL 71

Expert Comment

by:Éric Moreau
ID: 7128632
No need for a IF, use this:

 X = rsTable1.Fields("TextField") & ""

>>Not able to replicate the problem here at this office.

re-install mdac_typ.exe

Author Comment

ID: 7157475
Sorry for the delay in closing this out.  I am not going to be able to test this for several weeks so I am just closing it out.  Thanks for the help.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

586 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