ASP中是如何使用存储过程的
类别: ASP.NET教程
Start!
下面是创建存储过程
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\")&\"<br>\")
end while
myreader.Close()
conn.CLose()
%>
End
下面是创建存储过程
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\")&\"<br>\")
end while
myreader.Close()
conn.CLose()
%>
End
- 上一篇: C#中的函数重载
- 下一篇: 深入讲解 ASP+ 验证(一)
-= 资 源 教 程 =-
文 章 搜 索