Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Loosing connection to MS SQL Server text field

Posted on 2002-07-03
4
Medium Priority
?
119 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
aikimark earned 100 total points
ID: 7127805
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
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.
0
 
LVL 70

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
0
 
LVL 7

Author Comment

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

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Suggested Courses

636 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