A simple ASP calling process query written by yourself

xiaoxiao2021-03-06  130

This article uses not to use the adoDb.command command, just simply do a stored procedure with AdoDb.RecordSet. Store procedure: 'Creating dbo.tse stored procedure Create Procedure [DBO] in SQL Create Procedure [DBO]. [TSE] @keyword varchar (20) = null,' Define Query Keyword @choose int = null 'Define the type of query (1 is Query column Title, other content) as if @ choose = 1 Select * from Web Where Title Like @keyword '%' Else Select * from Web Where Content Like @keyword '%' Returngo'List.asp page <% DIM RSDIM SQLDIM Keywordddim ChooseKeyword = Request ("Keyword") 'Receive the value of page Transfer Choose = Request ("Choose") SET RS = Server.createObject ("AdoDB .recordset ") SQL =" EXEC TSE '"& Keyword &"', "& Choose &" "Execute the TSE stored procedure with EXEC, transfer keyword, choos to store procedures RS.Open SQL, CONN, 1, 1IF RS.EOF AND rs.bof thenresponse.write ( "! no records") response.endend ifresponse.write "to search the records as follows:

" do until rs.eof response.write "" & rs ( "id") & ":" & rs ( "title") & "" 'response.write print out the ID and title of the article "

" rs.movenextloop' sweep the battlefield rs.closeconn.closeset rs = nothing set conn = nothing %>

转载请注明原文地址:https://www.9cbs.com/read-99718.html

New Post(0)