VB设计数据库系统中 修改代码怎么写

PrivateSubCommand3_Click()IfText1.Text=""ThenMsgBox("请输入要修改的用户记录")ElseAdodc1.Connecti... Private Sub Command3_Click()
If Text1.Text = "" Then
MsgBox ("请输入要修改的用户记录")
Else
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=zhangyaling;Data Source=(local)"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "select * from sent where 编号 = '" & Trim(Text1.Text) & "'"
Adodc1.Recordset.Fields("编号") = Trim(Text1.Text)
Adodc1.Recordset.Fields("住址") = Trim(Text2.Text)
Adodc1.Recordset.Fields("面积") = Trim(Text3.Text)
Adodc1.Recordset("楼层") = Trim(Text4.Text)
Adodc1.Recordset("竣工时间") = Trim(Text5.Text)
Adodc1.Recordset("周围环境") = Trim(Text8.Text)
Adodc1.Recordset("房型") = Trim(Text7.Text)
Adodc1.Recordset("用途") = Trim(Text6.Text)
Adodc1.Recordset("朝向") = Trim(Text9.Text)
Adodc1.Recordset("装修情况") = Trim(Text11.Text)
Adodc1.Recordset("联系人") = Trim(Text12.Text)
Adodc1.Recordset("联系电话") = Trim(Text13.Text)
Adodc1.Recordset("售价") = Trim(Text10.Text)
Adodc1.Recordset("身份证号") = Val(Text14.Text)
Adodc1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Command1.Enabled = True
MsgBox "修改成功"
End If
End Sub
展开
 我来答
glass_nfl49ac
2011-06-13 · TA获得超过1031个赞
知道大有可为答主
回答量:2711
采纳率:79%
帮助的人:604万
展开全部
发给你一段代码:(修改),看明白后,修改你的拦巧模程序.
------------------------------------------------------------
Private Sub Command2_Click() '修改/更新
Set RS = New ADODB.Recordset
Dim StrSql As String
Dim L As Integer
My_Old$ = ""
L = Len(Txt_NO.Text)
If L < 3 Then MsgBox "输入[3位编号]才是正确的OK", 16, "操作提示": Screen.MousePointer = 0: Exit Sub
My_Old$ = Txt_NO.Text
StrSql = "select count(*) from BG_L_LB where 编号='" & Mid(My_Old$, 1, 3) & "'"
RS.Open StrSql, mConn, adOpenKeyset, adLockOptimistic
MY_app = RS.Fields(0)
RS.Close
If MY_app = 1 Then
StrSql = ""
If My_Old$ <> "" And Txt_name.Text <> "" And Txt_dw.Text <> "" Then
'StrSql = "Insert Into BG_L_LB(编号,名称,单位 ) values ('" & my_D_NO$ & "','" & Txt_name.Text & "','" & Txt_dw.Text & "宽悉')"
StrSql = "UPdate BG_L_LB set 名称='" & Txt_name.Text & "',单位='" & Txt_dw.Text & "' where 编号='" & My_Old$ & "'"
mConn.Execute StrSql
MsgBox "【货品类别:修改更简缓新成功!!!】! ", vbOKCancel, "操作提示": Exit Sub
End If
My_Old$ = ""
Txt_NO.Text = ""
Txt_name.Text = ""
Txt_dw.Text = ""
Command2.Enabled = False
End If
End Sub
AiPPT
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图... 点击进入详情页
本回答由AiPPT提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式