store procedure:
_________________________________________________
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[outputParms]
(
@count int output,
@sum int output
)
AS
BEGIN
declare @t table(id int identity(1,1), value int)
insert into @t
select 10 union all
select 20 union all
select 30
select @count = count(1), @sum = sum(value) from @t
select * from @t
END
.cs:
_________________________________________________
protected void Page_Load(object sender, EventArgs e)
{
SqlParameter[] parms = new SqlParameter[2];
parms[0] = new SqlParameter("@count",SqlDbType.Int);
parms[0].Direction=ParameterDirection.Output;
parms[1] = new SqlParameter("@sum", SqlDbType.Int);
parms[1].Direction = ParameterDirection.Output;
string strConn = @"server=EN0075\SQLEXPRESS; database=test; uid=reader; pwd=reader;";
DataTable dt = SqlHelper.ExecuteDataset(strConn, CommandType.StoredProcedure, "outputParms", parms).Tables[0];
Response.Write("parms[0].Value: " + parms[0].Value.ToString() + "<br>");
Response.Write("parms[1].Value: " + parms[1].Value.ToString() + "<br>");
for (int i = 0; i <dt.Rows.Count ; i++)
{
Response.Write("Rows " + Convert.ToInt16(i +1).ToString() + ":" + dt.Rows[i][1].ToString() + "<br>");
}
}
store procedure
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Latest Pass Exam With Avaya 31860X Exam Dumps(2022)
declanriver34125
2022-06-20 20:37:57
Databricks Certified Professional Data Scientist Exam Dumps-Easiest Preparation Method(2022)
declanriver34125
2022-06-20 20:23:31
Salesforce Sales Cloud Consultant Practice Test - Best Preparation Material
declanriver34125
2022-06-18 19:23:01
Salesforce Certified Administrator Practice Test - Effective Tips To Pass
declanriver34125
2022-06-18 19:07:55
NBA Finals Game 6 live Free
jeffreycklima
2022-06-17 03:19:12
sdghjkghjgfjhfg
jeffreycklima
2022-06-12 06:25:41
GCP-GC-REP Exam Questions Help You to Score Higher in Your Genesys Exam
jamesconnorx7
2022-06-11 20:09:00
Blood Boost Formula (2022 Update) Customer Complaints & Health Risks?
triciusti
2022-06-10 20:26:25
FWEGESR WAGESR
tahad17me
2022-06-06 15:45:12
Cost-Effective Backup Approach to Promote Backup as a Service Market
reportsfuture24
2022-05-02 17:43:41
Dissertation Writing Services UK
henryrosie890
2022-05-02 16:40:42
Global Probe Card Market segmented By Type (Cantilever Probe Card, MEMS Probe Card, and Vertical Pro
syedsimranskyquest
2022-04-29 00:21:50
Global Hard Seltzer Market Study
manti.manna.skyquestt
2022-04-27 16:17:23