关于vb与oracle的问题,急,等!

qianyu9880 2003-04-03 06:59:12
我在oracle数据库中有两张表, cc_department和cc_device表。combo1中放着从数据库cc_department表中搜索出来的部门号(dept_no),根据选择部门号从cc_device表中搜索出符合条件的记录,再把这些记录的某些字段值作修改后写回到数据库中。可是调试是出现:
提供者不支持应用程序所要求的操作。错误语名指向:
rs.Fields("havedepr_amt").Value = amt1这一句,若把amt1改成具体的数据值也是一样的错误,不知错在哪里?

Private Sub Cmdzhejiu_Click()
Dim db As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim number As Variant '设备编号
Dim strno As String
Dim x As Variant '已使用月数
Dim y As Variant '固定资产折旧年限
Dim z As Variant '购入金额,即原值
Dim status As Variant '设备状态
'Dim amt1 As Variant '折旧金额=已提折旧
Dim amt2 As Variant '折旧后金额
Dim str As String
Dim i As Integer
str = Left(Trim(Combo1.Text), 3) '部门名称
If str = "" Then
MsgBox "请先选择部门", vbOKOnly + vbCritical, "确认!"
Exit Sub
End If
db.ConnectionString = "Provider=MSDAORA.1;Password=ender;User ID=ender;Data Source=sbms_run;Persist Security Info=True"
db.Open db.ConnectionString
db.CursorLocation = adUseClient
rs.Open "select * from cc_device where dept_no='" & str & " '", db, adOpenStatic, adLockReadOnly
'Set DataGrid1.DataSource = rs
For i = 0 To Val(rs.RecordCount) - 1
'strno = Trim(rs.Fields("dept_no").Value)
'If str = strno Then
number = Trim(rs.Fields("dev_no").Value)
x = Trim(rs.Fields("used_monthes").Value)
y = Trim(rs.Fields("life").Value)
z = Trim(rs.Fields("buy_amt").Value)
status = Trim(rs.Fields("dev_status").Value)
number = Mid(number, 5, 1)
If number = 0 Then '判断是否是固定资产
If status = 1 Then '判断是否是使用状态
amt1 = zhejiu(x, y, z) '折旧
amt2 = z - amt1
rs.Fields("havedepr_amt").Value = amt1
rs.Fields("depr_amt").Value = amt2
End If
End If
rs.MoveNext
'End If
Next i
rs.Close
End Sub
...全文
2 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wangxiaokaiasdf 2003-04-04
可能是类型转化不对,
回复
相关推荐
发帖

1187

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2003-04-03 06:59
社区公告
暂无公告