日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

C#里调用带输出参数的存储过程

發布時間:2025/5/22 C# 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C#里调用带输出参数的存储过程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
C#里調用帶輸出參數的存儲過程 ?1using?System;
?2using?System.Collections.Generic;
?3using?System.Linq;
?4using?System.Text;
?5using?System.Threading;
?6using?System.Data;
?7using?System.Data.SqlClient;
?8namespace?ConsoleApplicationTest
?9{
10????class?Program
11????{
12????????static?void?Main(string[]?args)
13????????{
14????????????try
15????????????{
16????????????????//connection對象
17????????????????string?strConn?=?"Data?Source=.;uid=sa;pwd=wzb0227;Integrated?Security=SSPI;Initial?Catalog=Evaluation;Integrated?Security=True";
18????????????????SqlConnection?conn?=?new?SqlConnection(strConn);
19????????????????conn.Open();
20????????????????//command對象
21????????????????SqlCommand?comm?=?new?SqlCommand("getCountNum",?conn);
22????????????????comm.CommandType?=?CommandType.StoredProcedure;
23????????????????//填充參數
24????????????????SqlParameter?para?=?new?SqlParameter("@count",?SqlDbType.Int);
25????????????????para.Direction?=?ParameterDirection.Output;
26????????????????comm.Parameters.Add(para);
27????????????????//執行,取輸出參數
28????????????????comm.ExecuteNonQuery();
29????????????????int?count?=?(int)comm.Parameters["@count"].Value;
30????????????????conn.Close();
31????????????????Console.WriteLine("count="?+?count);
32????????????}

33????????????catch
34????????????{
35????????????????Console.WriteLine("出現了異常!");
36????????????}

37????????}

38????}

39}
posted on 2008-12-19 10:57 彬子 閱讀(...) 評論(...) 編輯 收藏

轉載于:https://www.cnblogs.com/wangzb/archive/2008/12/19/1358124.html

總結

以上是生活随笔為你收集整理的C#里调用带输出参数的存储过程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。