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

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长度字符的提示,可是我必须让使用者有选择,不填也可以~在数据库的表格中也为空!该怎么做?
...全文
76 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
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.

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧