简体   繁体   English

从Firebird 2.0存储过程填充ASP.NET SqlDataSource

[英]Populating ASP.NET SqlDataSource from a Firebird 2.0 Stored Procedure

I am working on a project where I do not have any control over the versions of products that I have been asked to work with. 我正在做一个项目,该项目对我被要求使用的产品的版本没有任何控制权。

I am building an ASP.NET user control. 我正在构建一个ASP.NET用户控件。 Data is retrieved via SqlDataSource controls working against Firebired 2.0 databases. 通过针对Firebired 2.0数据库的SqlDataSource控件检索数据。 Everything was fine until I needed to populate one of the SqlDataSource controls via a stored procedure rather than a SELECT statement. 一切都很好,直到我需要通过存储过程而不是SELECT语句填充SqlDataSource控件之一为止。

I have verified that the procedure is returning data in EMS SQL Manager for Interbase and Firebird. 我已经验证该过程正在Interbase和Firebird的EMS SQL Manager中返回数据。 However, when I set the SqlDataSource 's SelectCommand property to EXECUTE PROCEDURE myProc and call Select() , I am getting no data. 但是,当我将SqlDataSourceSelectCommand属性设置为EXECUTE PROCEDURE myProc并调用Select()时,没有任何数据。

My procedure takes no input parameters so it seems to me that it should be straight-forward. 我的过程没有任何输入参数,因此在我看来它应该简单明了。

The reality of the situation is that I could use a simple SELECT statement if I were able to move to even 2.1 as I would have access to the List() aggregate function, but that is not a possibility. 这种情况的现实情况是,如果我能够移动到2.1,则可以使用一个简单的SELECT语句,因为我可以访问List()聚合函数,但这是不可能的。

Does anyone have any experience trying to do this? 有没有人有尝试这样做的经验? Does the procedure call need to be modified in any way? 是否需要以任何方式修改过程调用? Any help would be greatly appreciated. 任何帮助将不胜感激。

I would normally do this like so (against SQL Server) : 我通常会这样做(针对SQL Server):

// set the SqlDataSource's SelectCommand to the *name* of the stored procedure
myDataSource.SelectCommand = "myProc";

// tell the SqlDataSource that this is a *stored procedure* now
myDataSource.SelectCommandType = CommandType.StoredProcedure;

Since your stored procedure takes no input parameters at all, this should really be all! 由于您的存储过程根本不需要任何输入参数,因此实际上应该就是全部!

With SQL Server, selecting the data works just fine with this setup. 使用SQL Server,选择数据可以在此设置下正常工作。

If it is selectable stored procedure (it has SUSPEND command in it) then you should call it with SELECT statement, not with EXECUTE PROCEDURE statement. 如果它是可选的存储过程(其中具有SUSPEND命令),则应使用SELECT语句而不是EXECUTE PROCEDURE语句来调用它。 So set your SelectCommand to 因此,将您的SelectCommand设置为

SELECT * FROM spName

and it should work. 它应该工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET C#:带有存储过程和参数的 SqlDataSource - ASP.NET C#: SqlDataSource with Stored Procedure and Parameters 更改的存储过程无法在ASP.NET中识别-SQLDataSource - Changed stored procedure not recognized in ASP.NET - SQLDataSource ASP .NET-如何通过SQLDataSource从存储过程中获取值 - ASP .NET - How to get the value from a stored procedure via a SQLDataSource SqlDataSource上的存储过程不能使用单引号C#asp.net在SelectCommand中使用单引号 - Stored procedure on the SqlDataSource is not working with single quotation inside SelectCommand with single quotation C# asp.net 将参数添加到sqldatasource,我应该如何传递它们以在ASP.NET中执行我的存储过程 - Adding parameter to sqldatasource, How should i pass them to execute my stored procedure in asp.net 如何通过Asp.net中的SqlDataSource存储过程参数将Int32输入发送到数据库 - How to send Int32 input to database through SqlDataSource stored procedure parameter in Asp.net ASP.NET SQLDataSource预计FilterExpression中的列将位于“存储过程的选择语句”中 - ASP.NET SQLDataSource Expects columns in FilterExpression to be in Select Statement of Stored Procedure 使用存储过程而不是使用SqlDataSource更新和删除GridView ASP.NET C#中的行 - Update and Delete rows in GridView ASP.NET C# using stored procedure instead of using SqlDataSource 存储过程不能从 ASP.NET 工作 - Stored Procedure not working from ASP.NET ASP.NET 2.0:如何将asp:Menu绑定到SqlDataSource? - ASP.NET 2.0: How to bind an asp:Menu to an SqlDataSource?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM