以下是我的存儲過程。如何獲取作爲存儲過程結果的數據表
ALTER PROCEDURE SP_GetModels
(
@CategoryID bigint
)
AS
BEGIN
Select ModelID,ModelName From Model where [email protected]
END
和我打電話在後面的代碼作爲
public SqlConnection conn;
public SqlDataReader GetModels()
{
DataTable dt = new DataTable();
public void DbConnection()
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SampleCs"].ConnectionString);
conn.Open();
}
DbConnection();
SqlCommand cmd = new SqlCommand("SP_GetModels", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@CategoryID", SqlDbType.BigInt, 10).Value = CategoryID;
// SqlDataAdapter madap = new SqlDataAdapter(cmd, conn);
SqlDataReader dreader= cmd.ExecuteReader();
//madap.Fill(dt);
return dreader;
}
我有一個下拉列表,而我具有結合其含有MODELNAME DataReader對象存儲過程。 如何設置數據源爲DropDownList作爲DataReader的
怎麼樣在t SQL數據表有旁邊的輸出參數?如何獲得輸出參數呢?可能嗎?樣品? – 2015-07-30 09:07:55