| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 936 人关注过本帖
标题:数据库连接问题
只看楼主 加入收藏
wfemile
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2008-7-20
收藏
 问题点数:0 回复次数:3 
数据库连接问题
用字符连接的地方不知道有没有问题!!请高手过目下。。十分感谢!!
function getrecordsetwithid(strtablename,intid,intopentype)
  dim strsql
  strsql="select * from " & strtablename & " where id=" & intid
  set getrecordsetwithid=getrecordset(strsql,intopentype)
end function

function isexiststringvalue(srtablename,strfield,strvalue)
  dim strsql,rs
    strsql="select count(*) as count from" & strtablename & "where" & strfield &  "='" & strvalue & "'"
    set rs=getrecordset(strsql,0)
    if rs("count").value=0 then
    isexiststringvalue=false
    else
    isexiststringvalue=true
    end if
    set rs=nothing
end function

function isexiststringvaluewithoutid(strtablename,strfield,strvalue,intid)
     dim strsql,rs
     strsql="select count(*) as count from" & strtablename &  "where" & strfield & "='" &strvalue & "'" & "and id<>" & intid
   set rs=getrecordset(strsql,0)
 if rs("count").value=0 then
   isexiststringvaluewithoutid=false
   else
  isexiststringvaluewithoutid=true
end if
end function
用字符连接的地方不知道有没有问题!!请高手过目下。。十分感谢!!
搜索更多相关主题的帖子: 数据库 strsql count strtablename set 
2008-07-21 22:34
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
select count(*) as count这个as后面的别名不能是count
2008-07-21 23:55
wfemile
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2008-7-20
收藏
得分:0 
这个把列取名为count。应该没问题吧
2008-07-22 20:49
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
最好避免变量或别名使用系统关键字
2008-07-22 23:46
快速回复:数据库连接问题
数据加载中...
 
   



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

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