vb修改数据库表

来源:百度知道 编辑:UC知道 时间:2024/05/31 05:58:16
Set cn = New ADODB.Connection
Set res = New ADODB.Recordset
cn.Open "provider=SQLOLEDB;server=it;database=khgl;uid=sa;pwd=123456"
res.CursorLocation = adUseClient
res.Open "select * from khgl", cn, adOpenStatic, adLockOptimistic
Set frm_xxxg.MSHFlexGrid1.DataSource = res
res.AddNew
On Error Resume Next
If Check1.Value = Checked Then
res!来电时间 = DTP1.Value
Else
DTP1.Enabled = False
End If
If Check2.Value = Checked Then

res!去电时间 = DTP2.Value
Else
DTP2.Enabled = False
End If
res!公司名称 = Text1.Text
res!客户区域 = Text2.Text
res!联系人 = Text3.Text
res!联系电话 = Text4.Text
res!产品 = Text5.Text
res!认证类型 = Text6.Text
res!客户问题 = Text7.Text
res!销售代表 = Combo1.Text
res!跟踪进展1 = Text8.Text
res!跟

res!id = Text14.Text
If Check1.Value = 1 Then
res!来电时间 = DTP1.Value
Else
DTP1.Enabled = False
DTP1.Value = vbNull
End If
If Check2.Value = 1 Then
res!去电时间 = DTP2.Value

Else
DTP2.Enabled = False
DTP3.Value = vbNull
End If
res!公司名称 = Text1.Text
res!客户区域 = Text2.Text
res!联系人 = Text3.Text
res!联系电话 = Text4.Text
res!产品 = Text5.Text
res!认证类型 = Text6.Text
res!客户问题 = Text7.Text
res!销售代表 = Combo1.Text
res!跟踪进展1 = Text8.Text
res!跟踪进展2 = Text15.Text
res!跟踪进展3 = Text15.Text
res!当时回复 = Combo2.Text
res!业务部门 = Combo3.Text
res!客户分类 = Combo4.Text
If Check3.Value = 1 Then
res!询价时间 = DTP3.Value
Else
DTP3.Ena