• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 122
  • Last Modified:

Loosing connection to MS SQL Server text field

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
EYoung
Asked:
EYoung
  • 2
1 Solution
 
aikimarkCommented:
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
 
EYoungAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
EYoungAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now