TO IVAN
是的,用VB写的,数据库是SQLSEVER7,我找不到错误。但就是报这个错,无法更新。:(
是的,用VB写的,数据库是SQLSEVER7,我找不到错误。但就是报这个错,无法更新。:(
解决方案 »
- vb连接ACCESS数据库时,怎么才能在其他机器上不用重新定位数据库啊
- 當點擊ToolBar控件時怎麼沒觸發上一控件的Lostfocus事件
- 一个难题,关于INI文件和LISTBOX
- Text文本框,怎样知道里面有多少字节数据??????求助各位!!!!!!!!!!!
- 请问如何将查询的结果输出到报表,谢谢
- 怎不让Text控件弹出右键菜单
- 高手请进,如何通知程序的一个副本?
- 怎样注册DLL文件?急急
- 大家帮忙看一下,为什么mschart总漏掉我第一条记录?
- 如何用Winsock向网页提交数据或密码(以前有过可以查QQ号码是否在线的代码,现在找不到了)???
- 高分求购MOXA PComm Pro串口应用软件开发工具包!
- 各位API高手,帮小弟一下,有100分赠送.
sql="update table set col1='',....."
ADO就是这样的啦。
现在已经不报错了,可是怎么也存不进数据库了。我是个初手
Public cnn As ADODB.Connection
Public addflag As Boolean
Public pcinfo As ADODB.Recordset
Set pcinfo = New ADODB.Recordset
pcinfo.Open "select infoid,jb_person.cyear as pcyear,jb_person.pid as ppid,pname,sex,nation," & _
"clan,knowledge,workinghours,duty,uname,pss,comptname,compstime," & _
"gradutime,pborn,jb_regent.cyear as ccyear,techsetid,sectionid,jb_regent.pid as cpid," & _
"rid,uption,doption,eoption,bin,tel,re from jb_person,jb_regent " & _
"where infoid = 8 and jb_person.pid = jb_regent.pid ", cnn, adOpenStatic, adLockOptimistic
……
Public Function mnurdsave()
'On Error Resume Next
With pcinfo
!infoid = 8
!pcyear = Text(1).Text
!ppid = Text(3).Text
!pname = Text(2).Text
!sex = rdsave(Combox(2), 1)
!nation = rdsave(Combox(3), 2)
!clan = rdsave(Combox(4), 2)
!knowledge = rdsave(Combox(5), 2)
!workinghours = DTPicker(2).Value
!duty = rdsave(Combox(7), 2)
!comptname = rdsave(Combox(8), 3)
!compstime = DTPicker(4).Value
!uname = Text(4).Text
!pss = rdsave(Combox(6), 6)
!gradutime = DTPicker(1).Value
!pborn = DTPicker(0).Value
If Optyes0(0).Value = True Then
!uption = 1
Else
!uption = 0
End If
If Optyes1(1).Value = True Then
!doption = 1
Else
!doption = 0
End If
If Optyes2(2).Value = True Then
!eoption = 1
Else
!eoption = 0
End If
If !uption = 1 And !doption = 1 And !eoption = 1 Then
!bin = 1
Else
!bin = 0
End If
!ccyear = Text(1).Text
!techsetid = rdsave(Combox(0), 2)
!sectionid = rdsave(Combox(1), 1)
!cpid = Text(3).Text
!rid = Text(0).Text
!tel = Text(5).Text
!re = Text(6).Text
.Update
End WithEnd Function
Public Function rdread(ByVal mcmb As ComboBox, mstr As Variant) As Integer
Dim i, j As Integer
Dim serchi As Booleanserchi = False
i = mcmb.ListCount - 1If mstr = "" Then
rdread = -1
Else
Do While i > -1
If mcmb.ItemData(i) = mstr Then
j = i
serchi = True
Exit Do
End If
i = i - 1
Loop
End If
If serchi = False Then
rdread = -1
Else: rdread = j
End If
End FunctionPublic Function rdsave(ByVal mcmb As ComboBox, i As Variant) As String
Dim ystr As String
If mcmb.ListIndex = -1 Then
ystr = ""
Else
ystr = Right("0000000000" & mcmb.ItemData(mcmb.ListIndex), i)
End If
rdsave = ystr
End Function
adOpenStatic, adLockOptimistic
改成 3, 3试试(对应的vb常量不记得了)
"clan,knowledge,workinghours,duty,uname,pss,comptname,compstime," & _
"gradutime,pborn,jb_regent.cyear as ccyear,techsetid,sectionid,jb_regent.pid as cpid," & _
"rid,uption,doption,eoption,bin,tel,re from jb_person,jb_regent " & _
"where infoid = 8 and jb_person.pid = jb_regent.pid ", cnn, adOpenStatic, adLockOptimistic
中的adopenstatic,adlockoptimistic
改为
adopendynamic,adlockpessimistic
具体说法看看MSDN