当前位置:首页 > 网络编程 > 数据库 > ACCESS > Access数据库中无效的字符字段的行为

Access数据库中无效的字符字段的行为

点击次数:29 次 发布日期:2008-11-22 13:50:57 作者:源代码网
源代码网推荐

Dealing with Null strings in Access database fields

By default Access string fields contain NULL values unless a string value (including a blank string like "") has been assigned. When you read these fields using recordsets into VB  string variables, you get a runtime type-mismatch error. The best way to deal with this problem is to use the built-in & operator to concatenate a blank string to each field as you read it. For example:

Dim DB As Database
Dim RS As Recordset
Dim sYear As String
Set DB = OpenDatabase("Biblio.mdb")
Set RS = DB.OpenRecordset("Authors")
sYear = "" & RS![Year Born]

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华