Solved

Loosing connection to MS SQL Server text field

Posted on 2002-07-03
4
111 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
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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

863 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

20 Experts available now in Live!

Get 1:1 Help Now