# Re: 字串和数字有 Null ?

Posted by OO on March 12, 1999 at 16:01:48:

In Reply to: Re: 字串和数字有 Null ? posted by 王空空 on March 10, 1999 at 12:46:35:

可以写个小程式来处理读入资料转成 SQL 的栏位值.

Function FieldValue(Value As Variant) As String
Select Case VarType(Value)
Case vbEmpty, vbNull
strRet = "Null"
Case vbInteger, vbLong, vbSingle, vbDouble, vbCurrency, vbDecimal, vbByte
strRet = Value
Case vbString
If Len(Value) = 0 Then
strRet = "Null"
Else
strRet = """" & Value & """"
End If
Case vbBoolean
strRet = IIf(Value, "True", "False")
End Select
FieldValue = strRet
End Function

Follow Ups: