How to use stored procedures in ASP!

xiaoxiao2021-03-06  42

Create a stored procedure

Create Procedure SELECT_FORUM

AS

SELECT * FROM Forum

Go

xx.aspx

<% @ Page language = "vb"%>

<% @ Import namespace = "system.data"%>

<% @ Import namespace = "system.data.sql"%>

<%

DIM CONN As SqlConnection

DIM CMD As Sqlcommand

DIM MyReader As SqldataReader

Conn = New SqlConnectio ("Server = localhost; uid = SONYSCE; PWD = 1NetSG; Database = 1NET")

CMD = New Sqlcommand ("SELECT_FORUM", CONN)

cmd.commandtype = commandtype.storedProcedure

Conn.open ()

cmd.execute (MyReader)

While myReader.read ()

Response.write (MyReader ("Content") & "
")

End while

MyReader.close ()

CONN.CLOSE ()

%>

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

New Post(0)