| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 518 人关注过本帖
标题:大哥们!!!救救我呀,求你们了!!!
取消只看楼主 加入收藏
iqpliqpl
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-12-1
收藏
 问题点数:0 回复次数:1 
大哥们!!!救救我呀,求你们了!!!
我在网上下了个数据查询的的代码,可改了以后就无法查询了
数据库是我新建的,
运行提示:对象变量或with块变量未设置
大哥们呀,这是哪错了呀,怎么改呀!先谢谢了!
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMeg As String
Dim mrc As ADODB.Recordset
Dim MsgText As String

For intCount = 0 To 1
If Trim(txtItem(intCount) & " ") = "" Then
Select Case intCount
Case 0
sMeg = "名称"
Case 1
sMeg = "绰号"
End Select
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus

Exit Sub
End If
Next intCount


If gintCmode = 1 Then
txtSQL = "select * from customers where xingming='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then 就是这个地方
MsgBox "已经存在此记录!", vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
Exit Sub
End If
mrc.Close
End If


If gintCmode = 2 Then
'先删除已有记录
txtSQL = "delete from customers where bianhao ='" & Trim(txtNo) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
End If

'再加入新记录
txtSQL = "select * from customers "
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew

mrc.Fields(0) = txtNo
For intCount = 0 To 17
mrc.Fields(intCount + 1) = Trim(txtItem(intCount))
Next intCount

mrc.Update
mrc.Close



If gintCmode = 1 Then
For intCount = 0 To 17
txtItem(intCount) = ""
Next intCount

mblChange = False
MsgBox "添加信息成功!", vbOKOnly + vbExclamation, "添加信息"

Unload Me
If flagCedit Then
Unload frmCustomer
frmCustomer.txtSQL = "select * from customers"
frmCustomer.Show
End If

ElseIf gintCmode = 2 Then
Unload Me
If flagCedit Then
Unload frmCustomer
End If
frmCustomer.txtSQL = "select * from customers"
frmCustomer.Show

End If
2005-12-01 15:37
iqpliqpl
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-12-1
收藏
得分:0 
先谢谢大哥,不过能告诉我原因吗?谢谢了
2005-12-01 16:18
快速回复:大哥们!!!救救我呀,求你们了!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024945 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved