请问如何在VB里面利用ADO的RECORDSET对象的ADDNEW插入某字段为NULL值呢?是否以下形式:
With RS
Set .ActiveConnection = Conn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open ("SELECT * FROM tblGoodsin")
.AddNew
.Fields("OrderNum").Value = 12553
.Fields("GoodsInMemo").Value ="NULL"
.Update
.Close
End With
请指点!
With RS
Set .ActiveConnection = Conn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open ("SELECT * FROM tblGoodsin")
.AddNew
.Fields("OrderNum").Value = 12553
.Fields("GoodsInMemo").Value ="NULL"
.Update
.Close
End With
请指点!
因为我想当用户不填写数据时为NULL值,而填写数据时为插入字符串!
若按照您的意思,是否这样:
if txtMemo.text <> "" then
.Fields("GoodsInMemo").Value =txtMemo.text
endif
这样就ok了,不要加''
因为我想当用户不填写数据时为NULL值,而填写数据时为插入字符串!
若按照您的意思,是否这样:
if txtMemo.text <> "" then
.Fields("GoodsInMemo").Value =txtMemo.text
endif
按照你的意思这样做才对