首先
假設存儲過程如下
AS
SELECT * FROM StudentInf
則此sp的調用如下
SqlCommand selectCMD = new SqlCommand(
//conn 為SqlConnection
selectCMD
如果需要將結果集加到某個DataAdapter上
SqlDataAdapter stuDA = new SqlDataAdapter();
stuDa
如果有參數
@StudentId varchar(
@StudentName varchar(
As
Select * from StudentInf where StudentId = @StudentId and StudentName = @StudentName
則參數可以如下添加
selectCMD
selectCMD
如果只有一個參數
SqlParameters onePara = selectCMD
onePara
From:http://tw.wingwit.com/Article/program/Java/hx/201311/27194.html