Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Convertion problem from access to SQLServer


Message #1 by "Vinod Thomas" <vthomas@a...> on Fri, 27 Jul 2001 17:28:37
Vinod,

   In MS Access, True/False is translated into -1/0 respectively.
An SQL bit field is only one bit which holds the values 1/0.

You have a few options here:

1) Change your datatype in SQL to something that can handle the value
	of -1.

2) Change your code to make sure you send 1 or 0 for that value.

3) Some other workaround to handle this situation.

My recommendation is to use option 2.  My reasoning is that in 
the beta version of .NET, the values of true and false were
changed.  Meaning that in VB 6.0, True equated to -1 and
False equated to 0.  In .NET Beta 1, True equated to 1 and
False equated to 0.  According to my sources, in .NET Beta 2
True now is back to -1 again.  While false is 0.

In C++ land, 0 is false and anything not 0 is true.

Because of the ambiguity of these concepts and the way
they translate into numbers, I would recommend using
an explicit value in your code to make sure that
your code is as foward compatible as it can be.

Just my 2 cents.

Cardyin

--------------------------------------
Cardyin Kim
C/S & Web Development Analyst
Information Services
San Antonio Community Hospital
ckim@s...     (xxx)xxx-xxxx     
--------------------------------------


-----Original Message-----
From: Vinod Thomas [mailto:vthomas@a...]
Sent: Friday, July 27, 2001 10:29 AM
To: professional vb
Subject: [pro_vb] Convertion problem from access to SQLServer


Hi,
I converted an access database to SQLServer and came across a 
typical problem. The Yes/no (bit columns) from access got converted to 
bit columns in SQLServer, but I am no longer able to insert/update values 
as True/False to that bit column. I believe that while retrieving bit data 
from database, it is coming in as True/False.
I was able to do this in access.

Thanks
Vinod


  Return to Index