佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > ASP調(diào)用存儲(chǔ)過(guò)程的技巧

ASP調(diào)用存儲(chǔ)過(guò)程的技巧

熱門(mén)標(biāo)簽:科大訊飛語(yǔ)音識(shí)別系統(tǒng) 電子圍欄 阿里云 團(tuán)購(gòu)網(wǎng)站 服務(wù)器配置 Linux服務(wù)器 Mysql連接數(shù)設(shè)置 銀行業(yè)務(wù)
1、最簡(jiǎn)單的如下 
           Dim objConn 
    Set objConn = Server.CreateObject("ADOBD.Connection") 
    objConn.Open Application("Connection_String") 
    'Call the stored procedure to increment a counter on the page 
    objConn.Execute "exec sp_AddHit" 
沒(méi)有參數(shù),沒(méi)有返回,沒(méi)有錯(cuò)誤處理,就是這個(gè)了 

2、帶參數(shù)的一種調(diào)用 
objConn.Execute "exec sp_AddHit,'http://www.asp001.net', 1" 
請(qǐng)注意分割參數(shù),該方法也不返回記錄 

3、返回記錄的 
          Dim objConn 
    Dim objRs 
    Set objConn = Server.CreateObject("ADOBD.Connection") 
    Set objRs = Server.CreateObject("ADOBD.Recordset") 
    objConn.Open Application("Connection_String") 
    'Call the stored procedure to increment a counter on the page 
    objRs.Open objConn, "exec sp_ListArticles '1/15/2001'" 
    'Loop through recordset and display each article 
4、…… 
          Dim objConn 
          Dim objCmd 

'Instantiate objects 
Set objConn        = Server.CreateObject("ADODB.Connection") 
set objCmd        = Server.CreateObject("ADODB.Command") 
conn.Open Application("ConnectionString") 

With objCmd 
    .ActiveConnection = conn 'You can also just specify a connection string here 
    .CommandText = "sp_InsertArticle"  
    .CommandType = adCmdStoredProc 'Requires the adovbs.inc file or typelib meta tag 

    'Add Input Parameters 
    .Parameters.Append .CreateParameter("@columnist_id", adDouble, adParamInput, , columnist_id) 
    .Parameters.Append .CreateParameter("@url", adVarChar, adParamInput, 255, url) 
    .Parameters.Append .CreateParameter("@title", adVarChar, adParamInput, 99, url) 
    .Parameters.Append .CreateParameter("@description", adLongVarChar, _ 
        adParamInput, 2147483647, description) 

    'Add Output Parameters 
    .Parameters.Append .CreateParameter("@link_id", adInteger, adParamOutput, , 0) 

    'Execute the function 
    'If not returning a recordset, use the adExecuteNoRecords parameter option 
    .Execute, , adExecuteNoRecords 
    link_id = .Parameters("@link_id") 
End With 

5、存儲(chǔ)過(guò)程的代碼 
Create PROCEDURE dbo.sp_InsertArticle 

    @columnist_id int, 
    @url varchar(255), 
    @title varchar(99), 
    @description text 
       @link_id int OUTPUT 

AS 
BEGIN 
    INSERT INTO dbo.t_link    (columnist_id,url,title,description) 
    VALUES (@columnist_id,@url,@title,@description) 

    SELECT @link_id = @@IDENTITY 
END

標(biāo)簽:萍鄉(xiāng) 蚌埠 廣元 棗莊 衡水 江蘇 衢州 大理

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP調(diào)用存儲(chǔ)過(guò)程的技巧》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話(huà)咨詢(xún)

    • 400-1100-266
    平乡县| 彭山县| 巴楚县| 邳州市| 抚州市| 衡阳市| 搜索| 伽师县| 大悟县| 阜宁县| 隆安县| 维西| 昭通市| 曲阳县| 平果县| 沁源县| 崇州市| 梁平县| 班戈县| 崇信县| 基隆市| 漾濞| 吐鲁番市| 公主岭市| 土默特右旗| 广州市| 囊谦县| 贵州省| 阿坝县| 耒阳市| 政和县| 壶关县| 遂平县| 永和县| 三都| 永泰县| 张掖市| 顺平县| 清丰县| 宾阳县| 巴中市|