如何使用具有通用数据库的企业库获取存储过程的参数



当我使用这个时,我得到以下异常

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调用它。细节问题。

最新更新