为什么我的程序里不能用下列的函数????

flc 2004-05-10 11:43:36
当一列不存在的时候,它提示:至少一个参数没被指定值
'***********************************************************************
Function CheckFieldsExist(TableName As String, FldName As String) As Boolean
'***********************
'判断一个表里的一列是否存在,如果存在则CheckFieldsExist=TRUE否则CheckFieldsExist=FALSE
'***********************
Dim STRSQL As String
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source ='" + App.Path + "\info.mdb';Persist Security Info=False"
On Error Resume Next

STRSQL = "SELECT & FldName & from & TableName"
cnn.Execute STRSQL'错误出现在此处,
CheckFieldsExist = (Err.Number = 0)
End Function



为什么呢???我怀疑是WIN98系统的问题,因为以前是好用的。并且其他的一些以前好用的函数,现在有的也不好用了。不知道什么原因。请指教。
...全文
133 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
flc 2004-05-10
  • 打赏
  • 举报
回复
明白了原来是设置捕捉错误为:发生错误中断,导致的。改为:在类模块中中断。就行了。
谢谢各位的关注
flc 2004-05-10
  • 打赏
  • 举报
回复
上楼的代码,也提示错误。
在cnn.Execute STRSQL行提示:至少一个参数没被指定值
这就是我为什么怀疑是系统的问题。
还想懒够 2004-05-10
  • 打赏
  • 举报
回复
楼上的代码没有什么问题啊

如果有问题,估计是你将错误提示切换至“发生错误时中断”了。

flc 2004-05-10
  • 打赏
  • 举报
回复
不好意思,帖错了是:
'***********************************************************************
Function CheckFieldsExist(TableName As String, FldName As String) As Boolean
'***********************
'判断一个表里的一列是否存在,如果存在则CheckFieldsExist=TRUE否则CheckFieldsExist=FALSE
'***********************

On Error Resume Next
Dim STRSQL As String
Dim cnn As New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source ='" + App.Path + "\info.mdb';Persist Security Info=False"
STRSQL = "SELECT " & FldName & " from " & TableName
cnn.Execute STRSQL
CheckFieldsExist = (Err.Number = 0)

End Function
yoki 2004-05-10
  • 打赏
  • 举报
回复
STRSQL = "SELECT " & FldName & " from " & TableName
huangjianyou 2004-05-10
  • 打赏
  • 举报
回复
肯定是这句话有问题啦:“ STRSQL = "SELECT & FldName & from & TableName" ”
northwolves 2004-05-10
  • 打赏
  • 举报
回复
STRSQL = "SELECT " & FldName & " from " & TableName

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧