Solved

Loosing connection to MS SQL Server text field

Posted on 2002-07-03
4
110 Views
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")
Else
   X = ""
End If

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

Thanks for the help
0
Comment
Question by:EYoung
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
aikimark earned 25 total points
Comment Utility
Try:
If IsNull(rsTable1.Fields("TextField").Value) Then
  X = ""
Else
  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?
0
 
LVL 7

Author Comment

by:EYoung
Comment Utility
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.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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
0
 
LVL 7

Author Comment

by:EYoung
Comment Utility
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now