数据库高手和斑猪(曾经帮我解决过很多问题的人)请进!

kofkim 2001-10-25 09:55:52
rsData.MoveFirst ' Move to the first record in the Recordset ojbect.
Do While Not rsData.EOF ' Loops until the Recordset is at end. (EOF = End Of File)
If LCase(rsData.Fields(0).Value) = LCase(txtSearchFor.Text) Then ' First we need to find the record we are going to change
' Its the right record
rsData.Edit ' Set the Recordset object in Edit mode.



rsData.Fields(1).Value = txtPhone.Text ' Set Row 1 data from txtPhone.text
rsData.Fields(2).Value = txtHome.Text ' Set Row 2 data from txtHome.text
If chkWorking.Value = Checked = True Then ' Set Row 3 true or false
rsData.Fields(3).Value = True
Else
rsData.Fields(3).Value = False
End If
'When we are done changing the record we need to update it.
rsData.Update

如果我要更新的记录不填写~就会出现不能写入0长度字符的提示,可是我必须让使用者有选择,不填也可以~在数据库的表格中也为空!该怎么做?
...全文
56 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
hejianzhong 2001-10-25
http://www.yescnet.com
http://user.7host.com/yescnet
http://perso.kilio.com/yescnet
http://home.domaindlx.com/yescnet
http://yyycnet.phidji.com
http://yescnet8.tf2hq.com
http://www.yescnet.net
http://www.websamba.com/yescnet
http://www.cnetpower.net
http://user.7host.com/cnetyes江湖
__________________

国外空间中文解决方案,支持任何语言,支持Access2000
__________________

动网论坛国外空间完整无错版
完全支持Access 2000

http://www.yescnet.com/manage.asp?url=down/list.asp**id=90
http://user.7host.com/yescnet/manag...l=down/list.asp**id=91

** 傲世江湖一鹤之国外空间版提供下载(支持非虚拟目录) **

下载:http://www.yescnet.com/manage.asp?url=down/list.asp**id=91
下载:http://user.7host.com/yescnet/manag...l=down/list.asp**id=92
示例:http://user.7host.com/cnetyes

** 傲世江湖一鹤之虚拟目录补丁 **

http://www.yescnet.com/manage.asp?url=down/list.asp**id=92
http://user.7host.com/yescnet/manag...l=down/list.asp**id=93

回复
kofkim 2001-10-25
rsData1.MoveFirst
Do While Not rsData1.EOF
'If LCase(rsData1.Fields(0).Value) = LCase(Text1(i).Text) Then
rsData1.Edit ' Set the Recordset object in Edit mode.
For i = 0 To 3
If IsNull(Text1(i).Text) Then
rsData1.Fields(i).Value = ""
Else
rsData1.Fields(i).Value = UCase(Text1(i).Text)
End If
Next i
rsData1.Update
MsgBox "成功更新了该记录", 0, "提示"
Exit Sub

rsData1.MoveNext
Loop
MsgBox "操作失败请检查", 0, "提示"

解决了~呵呵
我喝了杯咖啡~给所有关心我的人加分!
回复
blp 2001-10-25
rsData.Fields(1).Value = txtPhone.Text & ""
rsData.Fields(2).Value = txtHome.Text & ""


rsData.Fields(1).Value = format(txtPhone.Text)
rsData.Fields(2).Value = format(txtHome.Text)

回复
newyon 2001-10-25
把原来的后面加上 & "" 试试
rsData.Fields(1).Value = txtPhone.Text & ""
rsData.Fields(2).Value = txtHome.Text & ""
回复
kofkim 2001-10-25
呵呵~确实定义可空!
回复
ArmorCar 2001-10-25
Use varchar instead of char.
回复
christophe 2001-10-25
这不属于程序的事情,在定义数据库字段时,定义为可空,而不是not null.
回复
相关推荐
发帖

1187

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2001-10-25 09:55
社区公告
暂无公告