执行在数据集的 .xsd 中配置的存储过程
Executing a stored procedure that is configured in a dataset's .xsd
我在从我在数据集中设置的存储过程中获取数据时遇到困难。所以基本上在我的 xsd 中,我添加了 table 适配器并选择了我现有的存储过程 use existing procedure which as you can see returns the columns listed here returned columns。
这里是存储过程stored procedure I am using. I've made sure to add the binding source to the textbox as seen here Databindings. This is the binding source I am using Binding Source. Here is the method I am using to get pass a guid to the form Method。
当我选择第一张图片中看到的默认使用 SQL 语句选项时,我可以 return 数据,只需按如下方式编写我的代码。
SELECT
CustomersID,
ShopID,
CompanyID,
CustomerNumber,
LastName,
FirstName,
Address AS [Address],
State AS [State],
City AS City,
Zip AS Zip,
HomePhone AS HomePhone,
HomePhoneExt AS HomePhoneExt,
WorkPhone AS WorkPhone,
WorkPhoneExt AS WorkPhoneExt,
CellPhone AS CellPhone,
CellPhoneExt AS CellPhoneExt,
Email AS Email,
CustomerNotes AS CustomerNotes
FROM
dbo.tbl_Customers c WITH(NOLOCK)
WHERE
c.CustomersID = @ID
如何使用此方法集成我现有的存储过程以产生相同的结果,以便我可以更有效地重构存储过程,而不必为了简单的 SQL 修复而放弃新的构建?如果可能,我想避免使用 SqlCommand
by SqlConnection
方法。
看起来问题出在存储过程中...第一行是 RETURN ...所以过程在执行任何操作之前返回...RETURN 应该在最后。
尝试先在 SSMS 中获取过程 运行...然后将其引入 xsd。
[另一个不对劲的提示是 link 中 'returned columns' ......检查列的标题......它认为它们是参数。]
我在从我在数据集中设置的存储过程中获取数据时遇到困难。所以基本上在我的 xsd 中,我添加了 table 适配器并选择了我现有的存储过程 use existing procedure which as you can see returns the columns listed here returned columns。
这里是存储过程stored procedure I am using. I've made sure to add the binding source to the textbox as seen here Databindings. This is the binding source I am using Binding Source. Here is the method I am using to get pass a guid to the form Method。
当我选择第一张图片中看到的默认使用 SQL 语句选项时,我可以 return 数据,只需按如下方式编写我的代码。
SELECT
CustomersID,
ShopID,
CompanyID,
CustomerNumber,
LastName,
FirstName,
Address AS [Address],
State AS [State],
City AS City,
Zip AS Zip,
HomePhone AS HomePhone,
HomePhoneExt AS HomePhoneExt,
WorkPhone AS WorkPhone,
WorkPhoneExt AS WorkPhoneExt,
CellPhone AS CellPhone,
CellPhoneExt AS CellPhoneExt,
Email AS Email,
CustomerNotes AS CustomerNotes
FROM
dbo.tbl_Customers c WITH(NOLOCK)
WHERE
c.CustomersID = @ID
如何使用此方法集成我现有的存储过程以产生相同的结果,以便我可以更有效地重构存储过程,而不必为了简单的 SQL 修复而放弃新的构建?如果可能,我想避免使用 SqlCommand
by SqlConnection
方法。
看起来问题出在存储过程中...第一行是 RETURN ...所以过程在执行任何操作之前返回...RETURN 应该在最后。
尝试先在 SSMS 中获取过程 运行...然后将其引入 xsd。
[另一个不对劲的提示是 link 中 'returned columns' ......检查列的标题......它认为它们是参数。]