⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asp调用sql server存储程序.htm

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046)http://www6.163.com/it/item/0,2186,654,00.html -->
<!-- Vignette StoryServer 4 Tue Feb 26 14:44:01 2002 --><HTML><HEAD><TITLE>IT</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type><!-- Vignette StoryServer 4 Fri Jun 30 09:33:27 2000 -->
<STYLE type=text/css>P {
	FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
DIV {
	FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
.p1 {
	FONT-FAMILY: 宋体; FONT-SIZE: 9pt
}
.p2 {
	FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
.p3 {
	FONT-FAMILY: 宋体; FONT-SIZE: 14px
}
.p4 {
	FONT-FAMILY: 宋体; FONT-SIZE: 14px; LINE-HEIGHT: 14pt
}
.p5 {
	FONT-SIZE: 1pt
}
.headtable {
	FONT-SIZE: 9pt
}
A:hover {
	COLOR: red
}
A.t1:visited {
	COLOR: red
}
</STYLE>

<META content="MSHTML 5.00.2919.6307" name=GENERATOR></HEAD>
<BODY aLink=#ff0000 bgColor=#ffffff link=#383098 text=#000000 topMargin=0 
vLink=#336699><!-- Vignette StoryServer 4 Thu Nov 23 09:20:16 2000 -->
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
  <TBODY>
  <TR>
    <TD class=headtable height=54 width=200><A href="http://www.163.com/"><IMG 
      border=0 height=54 src="IT2.files/163logo.gif" width=160></A> <BR>&nbsp;<A 
      class=headtable href="http://freemail.yeah.net/"><FONT 
      color=#ff0000>赶快申请8M永久免费电子邮箱</FONT></A><BR>&nbsp;<A class=headtable 
      href="http://bj4.netease.com/feedback/jobs.html">网易公司诚聘英才</A> </A></TD>
    <TD align=right class=headtable width=540><FONT 
      color=#ff0000>&gt;&gt;</FONT><A 
      href="http://www.163.com/index.html">返回首页</A> <A 
      href="http://news.163.com/index.html"><FONT color=#ff0000>焦点新闻</FONT></A> 
      <A href="http://mall.163.com/">网易商城</A> <A 
      href="http://bj.163.com/">网易社区</A> <A 
      href="http://www.yeah.net/index.html">搜索引擎</A> <A 
      href="http://freemail.yeah.net/">免费邮件</A> <A 
      href="http://auctions.163.com/">网上拍卖</A> <A 
      href="http://www.163.com/serve/">个人服务</A><BR><!--Here is ad beginning.--><IFRAME 
      frameBorder=0 height=60 marginHeight=0 marginWidth=0 scrolling=no 
      src="IT2.files/site=www.163.htm" width=468 
      BORDERCOLOR="#000000"><SCRIPT LANGUAGE="JavaScript1.1" SRC=http://adserver.163.com/js.ng/site=www.163.com&category=it&type=banner></SCRIPT><NOSCRIPT><A HREF=http://ad1.163.com/click.ng/Params.richmedia=yes&site=www.163.com&category=it&type=banner><IMG SRC=http://ad1.163.com/image.ng/Params.richmedia=yes&site=www.163.com&category=it&type=banner></A></NOSCRIPT></IFRAME><!--Here is ad end.--></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=10 width=740>
  <TBODY>
  <TR>
    <TD><IMG border=0 height=0 src="IT2.files/dot.gif" width=0></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
  <TBODY>
  <TR>
    <TD width=70>
      <TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
        <TBODY>
        <TR align=middle bgColor=#eeeeee>
          <TD class=p1 height=20><A href="http://news.163.com/"><FONT 
            color=#000000>新闻</FONT></A></TD>
          <TD class=p1><A href="http://sports.163.com/"><FONT 
            color=#000000>体育</FONT></A></TD></TR></TBODY></TABLE></TD>
    <TD align=middle bgColor=#0036b2 class=p1 height=20 width=35><A 
      href="http://it.163.com/"><FONT color=#ffffff>电脑</FONT></A></TD>
    <TD width=490>
      <TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
        <TBODY>
        <TR align=middle bgColor=#eeeeee>
          <TD class=p1 height=20><A href="http://game.163.com/"><FONT 
            color=#000000>游戏</FONT></A></TD>
          <TD class=p1><A href="http://stock.163.com/"><FONT 
            color=#000000>财经</FONT></A></TD>
          <TD class=p1><A href="http://house.163.com/"><FONT 
            color=#000000>房产</FONT></A></TD>
          <TD class=p1><A href="http://culture.163.com/"><FONT 
            color=#000000>文化</FONT></A></TD>
          <TD class=p1><A href="http://lady.163.com/"><FONT 
            color=#000000>女性</FONT></A></TD>
          <TD class=p1><A href="http://movie.163.com/"><FONT 
            color=#000000>影视</FONT></A></TD>
          <TD class=p1><A href="http://music.163.com/"><FONT 
            color=#000000>音乐</FONT></A></TD>
          <TD class=p1><A href="http://life.163.com/"><FONT 
            color=#000000>生活</FONT></A></TD>
          <TD class=p1><A href="http://travel.163.com/"><FONT 
            color=#000000>旅游</FONT></A></TD>
          <TD class=p1><A href="http://science.163.com/"><FONT 
            color=#000000>科学</FONT></A></TD>
          <TD class=p1><A href="http://health.163.com/"><FONT 
            color=#000000>健康</FONT></A></TD>
          <TD class=p1><A href="http://jobs.163.com/"><FONT 
            color=#000000>职业</FONT></A></TD>
          <TD class=p1><A href="http://education.163.com/"><FONT 
            color=#000000>教育</FONT></A></TD>
          <TD class=p1><A href="http://spicy.163.com/"><FONT 
            color=#000000>新辣</FONT></A></TD></TR></TBODY></TABLE></TD><!--picture nav--><!--end picturenav-->
    <TD align=right class=p1 vAlign=bottom width=155><FONT 
      color=#ff0000></FONT></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
  <TBODY>
  <TR>
    <TD bgColor=#0036b2><SPACER height="1" type="block"></TR></TBODY></TABLE>
<TABLE>
  <TBODY>
  <TR>
    <TD align=middle class=p1><A 
      href="http://all.163.com/it/pcdigest/index.htm">PCD个人网络手册</A> <A 
      href="http://www.163.com/it/item/0,2186,7448,00.html">Intel技术专题</A> <A 
      href="http://topsoft.163.com/software/">热门软件排行榜</A> <A 
      href="http://mobile.163.com/"><FONT color=red>手机站</FONT>全新改版</A> <A 
      href="http://all.163.com/it/popunet/study/10-1.htm">上网享受再教育</A> <A 
      href="http://gz.163.com/it2.htm">IT易:电脑频道广东版</A> <A 
      href="http://www.eshop.com.cn/">eNet导购专家</A> <A 
      href="http://all.163.com/it/hardbase/index.htm">硬件资料库</A> </TD></TR>
  <TR>
    <TD bgColor=#0036b2 class=p5 height=2 width=750>.</TD></TR>
  <TR>
    <TD height=4></TR></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 width=0>
  <TBODY>
  <TR>
    <TD></TR></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=4 cellSpacing=0 width=591>
  <TBODY>
  <TR>
    <TD class=p2><A href="http://www6.163.com/it/index/0,2182,,00.html"><FONT 
      color=red>IT</FONT></A>&gt;&gt;&gt;<A 
      href="http://www6.163.com/it/category/0,2197,3,00.html"><FONT 
      color=red>软件时空</FONT></A>&gt;&gt;&gt;<A 
      href="http://www6.163.com/it/subcategory/0,2200,14,00.html"><FONT 
      color=red>编程指南</FONT></A>&gt;&gt;&gt;<FONT color=red>具体文章</FONT> </TD></TR>
  <TR>
    <TD align=middle class=p3 height=30><B>ASP调用SQL SERVER存储程序</B> 
      <P align=center>露茜 (07/13/1999)</P></TD></TR>
  <TR>
    <TD class=p2 width=591>
      <P class=p3>    调用数据库存储过程 <BR>  <%Set Dataconn = 
      Server.CreateObject("ADODB.Connection") <BR>  '建立连接对象 <BR>  Dataconn.Open 
      "DSN=SinoTrans;SERVER=APP_SERVER;UID=sa;PWD=;APP=Microsoft(R) Developer 
          Studio;WSID=APP_SERVER;Regional=Yes" <BR>  Set cmdTemp = 
      Server.CreateObject("ADODB.Command") <BR>  '建立命令对象 <BR>  Set rst = 
      Server.CreateObject("ADODB.Recordset") <BR>  '建立记录集对象 
      <BR>  cmdTemp.CommandText = "dbo.pd_test" '存储过程名称 
      <BR>  cmdTemp.CommandType = 4 <BR>  '命令类别为4,表示为存储过程 <BR>  Set 
      cmdTemp.ActiveConnection = Dataconn <BR>  Set tmpParam = 
      cmdTemp.CreateParameter("Return Value", 3, 4, 4) 
      <BR>  cmdTemp.Parameters.Append tmpParam <BR>  Set tmpParam = 
      cmdTemp.CreateParameter("@BeginDate", 135, 1, 16, riqi) <BR>  '创建输入参数对象 
      <BR>  cmdTemp.Parameters.Append tmpParam <BR>  rst.Open cmdTemp, , 1, 3 
      <BR>  '生成查询结果 <BR>%> 
      <BR>  这里调用的存储过程为pd_test,这种是ADO中提供的标准方法,但存在一个问题,就是当在存储过程中有两个以上的SELECT语句,但从逻辑上又不可能同时执行的时候,ADO会提示你存储过程中SELECT语句太多,解决方法是直接用ADO的CONNECTION对象的EXECUTE方法直接执行存储过程,如下: 
      <BR><% <BR>  Set Dataconn = Server.CreateObject("ADODB.Connection") 
      <BR>  '建立连接对象 <BR>  Dataconn.Open 
      "DSN=SinoTrans;SERVER=APP_SERVER;UID=sa;PWD=;APP=Microsoft(R) Developer 
      Studio;WSID=APP_SERVER;Regional=Yes" <BR>  ss = "EXECUTE dbo.pd_test " 
      &amp; "'" &amp; riqi1 &amp; "'" <BR>  Set rs = dataconn.Execute(ss) <BR>%> 
      <BR><BR>(资料来源<A href="http://www.chinaasp.com/">中国动感网络</A>)<!-- Vignette StoryServer 4 Tue Aug 15 17:42:01 2000 -->
      <SCRIPT language=JavaScript>function recommendNew(){	OpenWindow = window.open('http://talkshow.163.com/recommend.php?referer='+parent.location,'recWin','toolbar=no,scrollbars=no,menubar=no,width=470,height=470')}</SCRIPT>
       
      <P><A href="javascript:recommendNew()">请点此将本文推荐给你的好友!</A></P></TD></TR>
  <TR>
    <TD class=p2><A href="mailto:it@staff.163.com?subject=ASP调用SQL" 
      SERVER存储程序><FONT color=red>有话要说?请给我们来信!</FONT></A> </TD></TR>
  <TR>
    <TD align=right></TD></TR></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 height=400 width=8>
  <TBODY>
  <TR>
    <TD></TR></TBODY></TABLE><!-- Vignette StoryServer 4 Mon Nov 20 09:36:25 2000 -->
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 width=150>
  <TBODY>
  <TR>
    <TD>
      <TABLE border=0 cellPadding=0 cellSpacing=2 width=150>
        <TBODY>
        <TR>
          <TD align=middle class=p3 height=20><A href="http://www.163.com/it" 
            onclick="window.external.addFavorite('http://www.163.com/it','网易IT频道');return false" 
            title=网易IT频道><FONT 
    color=red>把本频道加入书签!</FONT></A></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD bgColor=#4274de>
      <TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
        <TBODY>
        <TR>
          <TD>
            <TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0 
            width="100%"><!--Begin the system software-->
              <TBODY>
              <TR>
                <TD align=middle bgColor=#4274de class=p4 colSpan=2><A 
                  href="http://www6.163.com/it/category/0,2197,1,00.html"><FONT 
                  color=#ffffff>IT瞭望</FONT></A></TD></TR>
              <TR>
                <TD bgColor=#000000 colSpan=2><SPACER height="1" 
                type="block"></TD></TR>
              <TR>
                <TD align=middle class=p2 width="50%"><A 
                  href="http://www6.163.com/it/subcategory/0,2200,4,00.html"><FONT 
                  color=#000000>业界动态</FONT></A> </TD>
                <TD align=middle class=p2 width="50%"><A 
                  href="http://www6.163.com/it/subcategory/0,2200,5,00.html"><FONT 
                  color=#000000>观点评论</FONT></A> </TD></TR>
              <TR>
                <TD align=middle class=p2 width="50%"><A 
                  href="http://www6.163.com/it/subcategory/0,2200,6,00.html"><FONT 
                  color=#000000>数字生活</FONT></A> </TD>
                <TD align=middle class=p2 width="50%"><A 
                  href="http://www6.163.com/it/subcategory/0,2200,26,00.html"><FONT 
                  color=#000000>深度报道</FONT></A> </TD></TR>
              <TR>
                <TD align=middle bgColor=#4274de class=p4 colSpan=2><A 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -