标题:关于数据库查询的问题
只看楼主
longwindwind
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-11-7
 问题点数:0 回复次数:2 
关于数据库查询的问题
这是我做的查询功能,哪位大虾告诉我一下,为什么当我查出记录以后仍然弹出对话框呢?
On Error GoTo err1
Set i = New ADODB.Connection
Set j = New ADODB.Recordset
Dim mysql As String
Select Case a
Case 1
mysql = "select * from yh where yhm='" & Trim(Text3.Text) & "'"
Case 2
mysql = "select * from yh where mm='" & Trim(Text3.Text) & "'"
End Select
i.ConnectionString = "provider=sqloledb.1;data source=(local);user id=sa;pwd=247162545;initial catalog=sdb"
i.Open
j.Open mysql, i, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = j
showdata
err1:
MsgBox Err.Description
搜索更多相关主题的帖子: 数据库 Case Set 
2005-11-10 20:55
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 
On Error GoTo err1
Set i = New ADODB.Connection
Set j = New ADODB.Recordset
Dim mysql As String
Select Case a
Case 1
mysql = "select * from yh where yhm='" & Trim(Text3.Text) & "'"
Case 2
mysql = "select * from yh where mm='" & Trim(Text3.Text) & "'"
End Select
i.ConnectionString = "provider=sqloledb.1;data source=(local);user id=sa;pwd=247162545;initial catalog=sdb"
i.Open
j.Open mysql, i, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = j
showdata
Exit Sub
err1:
MsgBox Err.Description

天津网站建设 http://www./
2005-11-10 22:51
longwindwind
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-11-7
得分:0 
谢谢版主~~~
2005-11-11 12:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-33352-1-1.html




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

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