簡體   English   中英

如何使用帶有常規數據庫的企業庫獲取存儲過程的參數

[英]How to get the parameters for a stored procedure using Enterprise library with generic database

當我使用它時,出現以下異常

Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery.

除了此過程,還有其他正確的方法嗎?

編輯

Database db = CustomDbFactory.CreateDataBase(connStrName); 
DbCommand command = db.DbProviderFactory.CreateCommand(); 
command.CommandText = @spName; 
command.CommandType = CommandType.StoredProcedure; 
db.DiscoverParameters(command); 
...

SqlDatabase對象僅支持此功能。 因此,不必在GenericDatabase上調用DiscoverParameters ,而必須從SqlDatabase進行調用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM