如果Rs中某些字段为空值的话,则以下程序会出错
Private Sub display()
txtID = Rs("cCustomerID")
txtName = Rs("vCustomerName")
txtAccountNumber = Rs("cAccountNumber")
End Sub处理方法之一是
Private Sub display()
txtID = Rs("cCustomerID")&""
txtName = Rs("vCustomerName")&""
txtAccountNumber = Rs("cAccountNumber")&""
End Sub请问这种方法好不好,或是对不对,有其他更好的方法吗?
Private Sub display()
txtID = Rs("cCustomerID")
txtName = Rs("vCustomerName")
txtAccountNumber = Rs("cAccountNumber")
End Sub处理方法之一是
Private Sub display()
txtID = Rs("cCustomerID")&""
txtName = Rs("vCustomerName")&""
txtAccountNumber = Rs("cAccountNumber")&""
End Sub请问这种方法好不好,或是对不对,有其他更好的方法吗?
txtID= IIf(IsNull(Rs.Fields("cCustomerID")), "", Rs.Fields("cCustomerID"))写入数据库
Rs.Fields("cCustomerID") = IIf(txtID.Text = "", Null, txtID.Text)
txtID.Text = Rs("cCustomerID").Value & ""
txtID.Text =""
Else
txtID.Text = Rs.Fields(cCustomerID).Value
End If