1.在VB中输出参数的存储过程的例子
2.在VB中不需要任何参数的存储过程

解决方案 »

  1.   

    class oprdbase
    dim conn
       Private Sub Class_Initialize
             Set conn=server.CreateObject ("adodb.connection")
     strConn="driver={SQL Server};server=ROSECN;uid=sa;Pwd=;database=website" 
     conn.open strConn
       End Sub
       
     public function getitemkindname(itemkind)
            Set MyCommand=server.createobject("adodb.command")
            Set MyCommand.ActiveConnection=conn
            MyCommand.CommandType=4
    MyCommand.CommandText="getitemkindname"
    Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
    MyCommand.Parameters.Append Myparam
    Set MyParam=MyCommand.CreateParameter("itemkindname",200,2,50)
    MyCommand.Parameters.Append Myparam
    MyCommand.Execute
    getitemkindname=MyCommand("itemkindname")
    set MyCommand=nothing
     end function
     
      public function getitemkindshow(itemkind)
            Set MyCommand=server.createobject("adodb.command")
            Set MyCommand.ActiveConnection=conn
            MyCommand.CommandType=4
    MyCommand.CommandText="getitemkindshow"
    Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
    MyCommand.Parameters.Append Myparam
    Set MyParam=MyCommand.CreateParameter("itemkindshow",200,2,50)
    MyCommand.Parameters.Append Myparam
    MyCommand.Execute
    getitemkindshow=MyCommand("itemkindshow")
    set MyCommand=nothing
     end function  public function querypurview(user_name,pwd,theip)  '查询权限
            set MyCommand=server.createobject("adodb.command")
            Set MyCommand.ActiveConnection=conn
            MyCommand.CommandType=4
           MyCommand.CommandText="querypurview"
           Set MyParam=MyCommand.CreateParameter("username",200,1,50,user_name)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("pwd",200,1,50,pwd)
           MyCommand.Parameters.Append Myparam
            Set MyParam=MyCommand.CreateParameter("theip",200,1,50,theip)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("right",3,2,4)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           theright=MyCommand("right")
           set MyCommand=nothing
           querypurview=theright
       end functionpublic function queryorder(ordercode,dengji,page,themode) '得到定单
           set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="queryordercode"
           Set MyParam=MyCommand.CreateParameter("ordercode",3,1,4,ordercode)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("dengji",3,1,4,dengji)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("page",3,1,4,1)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("themode",3,1,4,1)
           MyCommand.Parameters.Append Myparam
           'Set MyParam=MyCommand.CreateParameter("themode",3,1,4,item)
           'MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           rs.open MyCommand,,1,3
           set queryorder=rs
           set MyCommand=nothing
           set rs=nothing
          ' right=MyCommand("right")
          ' set MyCommand=nothing
    end function public function queryitemkind(contactpic) '查询种类
         set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="queryitemkind"
           Set MyParam=MyCommand.CreateParameter("contactpic",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           rs.open MyCommand,,3,3
           set queryitemkind=rs
           set MyCommand=nothing
           set rs=nothing
    end functionpublic function queryitem(itemkind)
       set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="queryitem"
           Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           rs.open MyCommand
           set queryitem=rs
           set MyCommand=nothing
           set rs=nothing
    end functionpublic function querypicall()  '这个是查询picprice的
       set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="querypicall"
           MyCommand.Execute
           rs.open MyCommand, ,3,3
           set querypicall=rs
           set MyCommand=nothing
           set rs=nothing
    end functionpublic function querypaymode()
       set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="querypaymode"
           MyCommand.Execute
           rs.open MyCommand
           set querypaymode=rs
           set MyCommand=nothing
           set rs=nothing
    end functionpublic function querypicpricesingle(picpricenum) '查单一的价格
       set rs=server.createobject("adodb.recordset")
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="querypicpricesingle"
            Set MyParam=MyCommand.CreateParameter("picpricenum",3,1,4,picpricenum)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           rs.open MyCommand,,3,3
           set querypicpricesingle=rs
           set MyCommand=nothing
           set rs=nothing
    end function
      

  2.   

    public function addnewitemkind(itemkindname,contactpic)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="addnewitemkind"
           Set MyParam=MyCommand.CreateParameter("itemkindname",200,1,50,itemkindname)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("contactpic",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemkindformshow",200,2,50)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           'response.write MyCommand("itemkind")
           thevalue = MyCommand("itemkindformshow")
          ' set MyCommand=nothing 
           'addnewitemkind=thevalue
           addnewitemkind=thevalue
    end functionpublic sub addpicprice(picsize,length,width,picprice,showyn,sequence)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="addpicprice"
           Set MyParam=MyCommand.CreateParameter("picsize",200,1,50,picsize)
           MyCommand.Parameters.Append Myparam
            Set MyParam=MyCommand.CreateParameter("length",3,1,4,length)
           MyCommand.Parameters.Append Myparam
            Set MyParam=MyCommand.CreateParameter("width",3,1,4,width)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("picprice",200,1,50,picprice)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("showyn",3,1,4,showyn)
           MyCommand.Parameters.Append Myparam
                  Set MyParam=MyCommand.CreateParameter("sequence",3,1,4,sequence)
           MyCommand.Parameters.Append Myparam
       
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub addnewitem(itemkind,itemname,itemprice,itemurl,contactpic,theitempicurl,itemcontent)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="addnewitem"
           Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemname",200,1,50,itemname)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemprice",3,1,4,itemprice)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemurl",200,1,50,itemurl)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("contactpic",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemcontent",200,1,2000,itemcontent)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("theitempicurl",200,1,50,theitempicurl)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub deletepicprice(picpricenum)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="deletepicprice"
           Set MyParam=MyCommand.CreateParameter("picpricenum",3,1,4,picpricenum)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub deleteitemkind(itemkind)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="deleteitemkind"
           Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub deleteitem(itemnum)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="deleteitem"
           Set MyParam=MyCommand.CreateParameter("itemnum",3,1,4,itemnum)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub edititemkind(itemkind,itemkindname,contactpic,itemkindformshow)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="edititemkind"
           Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemname",200,1,50,itemname)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("contactpic",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemkindformshow",200,1,50,itemkindformshow)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic sub edititem(itemkind,itemname,itemprice,itemurl,contactpic,show,itemcontent,itemnum,itemshow)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="edititem"
           Set MyParam=MyCommand.CreateParameter("itemkind",3,1,4,itemkind)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemname",200,1,50,itemname)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemprice",3,1,4,itemprice)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemurl",200,1,50,itemurl)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("contactpic",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("show",3,1,4,show)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemcontent",200,1,2000,itemcontent)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemnum",3,1,4,contactpic)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("itemshow",200,1,50,itemshow)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing    
     end sub
      

  3.   

    public sub editpicprice(picsize,length,width,picprice,showyn,showform,sequence,picpricenum)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="editpicprice"
           Set MyParam=MyCommand.CreateParameter("picsize",200,1,50,picsize)
           MyCommand.Parameters.Append Myparam
            Set MyParam=MyCommand.CreateParameter("length",3,1,4,length)
           MyCommand.Parameters.Append Myparam
            Set MyParam=MyCommand.CreateParameter("width",3,1,4,width)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("picprice",200,1,50,picprice)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("showyn",3,1,4,showyn)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("showform",200,1,50,showform)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("sequence",3,1,4,sequence)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("picpricenum",3,1,4,picpricenum)
           MyCommand.Parameters.Append Myparam
       
           MyCommand.Execute
           set MyCommand=nothing       
    end subpublic Sub saveattackip(ip,attackkind,pageurl,attackname)
           set MyCommand=server.createobject("adodb.command")
           Set MyCommand.ActiveConnection=conn
           MyCommand.CommandType=4
           MyCommand.CommandText="saveattackip"
           Set MyParam=MyCommand.CreateParameter("ip",200,1,50,ip)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("attackkind",200,1,50,attackkind)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("pageurl",200,1,50,pageurl)
           MyCommand.Parameters.Append Myparam
           Set MyParam=MyCommand.CreateParameter("attackname",200,1,50,attackname)
           MyCommand.Parameters.Append Myparam
           MyCommand.Execute
           set MyCommand=nothing
    end Sub