(Access数据库)在相应数据库文件中定义查询myfind:
select comid,comname,comaddr,comwanted
from cominfo
where comwanted like  '*' &strearch& '*'
在asp页缅中写:
mcomd.commandtext="findcom"
set recjg=mcomd.createparamter("strearch",200,1,40,comselect)

解决方案 »

  1.   

    o ,打错了,抵行为:mcomd.commandtext="myfind"
      

  2.   

    你的我不太懂问题,
    如果你写
    select ... from ... where ... 如果比较复杂的话。
    可以写一个存储过程代替
    create proc xxxx
    as 
    select .... from ... where...
    r然后把原来的查询语句换成存储过程名字就可以了。存储过程可以带参数的。
      

  3.   

    create proc sp_查询(@id int)
    as
    select * from table1 where id=@id
    go用的时候执行语句:exec sp_查询 1
    可以把table1中id=1的数据取出来
    存储过程只不过相当于在SQl server 中把语句实现编译好,这么简单的查询应该不会提高多少效率
      

  4.   

    S t o r e d P r o c e d u r e的标准写法:
    Create Procedure Procedure_Name
    Define Parameter
    A s
    SQL Structure
    上面的语法结构中, P r o c e d u r e _ N a m e为存储结构的的名字,也是你将在C o m m a n d中引用的
    名字。然后是定义输出和输入的参数。最后是一个S Q L结构化语句。下面是一个S t o r e d P r o c e d u r e
    的例子,它无需输入参数,也没有输出。
    Create Procedure Del_User
    A s
    Delect From Employee Where Job_ID=1
    如果我们要删除指定的J o b _ I D,则我们需要给这个S t o r e d P r o c e d u r e输入参数。
    Create Procedure Del_User1
    @intID int
    A s
    Delect From Employee Where Job_Id = @intID
    这里的@ i n t J o b就是一个输入参数,它可以从外部接受输入的值,下面是给它输入的a s p程
    序:
    Set conn=Server.CreateObject("ADODB.Connection")
    Set comm=Server.CreateObject("ADODB.Command")
    conn.ConnectionString="Driver={SQL Server};Server=ser;"&_
    " u i d = s a ; p s s s = ; d a t a b a s e = e m p l o y e e "
    c o n n . o p e n
    Co m m . A c t i v e C o n n e c t i o n = c o n n
    Co m m . C o m m a n d T y p e = a d C m d S t o r e d P r o c
    Comm.CommandType="Del_User1" ' 这里的名字就是前面定义过的S t o r e d P r o c e d u r e的名字。
    '下面就是参数的输入
    p a r a m = c o m m . C r e a t e P a r a m e t e r ( " I D " , a d I n t , a d P a r a m I n p u t , 4 )
    '这里的a d P a r a m I n p u t定义是最重要的。
    Param.Value=1 ' 这里的值可以输入你想要的值,也可以用R e q u e s t来获得
    Comm.Parameters.Append param
    Comm.Execute
    这样我们就可以向S t o r e d P r o c e d u r e传递参数了。
      

  5.   

    哇!哇!哇!
    怎么没人留下个MAIL什么的,嘿嘿
      

  6.   

    嘻嘻~~~~看来我无意中竟为CSDN吸聚了不少人气嘛~~~~~~它是不是该发给我一本程序员杂志呢! 嘿嘿~~~~
    谢谢各位的帮助哦,小妹我是初学者,还望各位以后能保持这份热情多多努力哦!呵呵~~~~
      

  7.   

    能留下qq吗?csdn女孩太少了