如何直接从数据集调用Sql Udf?它甚至可能吗? [英] How Do I Directly Call A Sql Udf From A Dataset ? Is It Even Possible ?

查看:106
本文介绍了如何直接从数据集调用Sql Udf?它甚至可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨每一个

i有一个带有udf getItemBalance的sql数据库,它接受itemId并返回它的余额

在visual basic中我使用的是强类型数据集

有没有办法直接在数据集中使用udf,代码如下:

dim balance as decimal = getItemBalance(ItemID)



i意味着没有使用命令对象?

谢谢

hi every one
i have a sql database with a udf getItemBalance that accepts itemId and returns its balance
in visual basic i am using a strongly typed dataset
is there a way to use the udf directly in the dataset with code like :
dim balance as decimal=getItemBalance(ItemID)
?
i mean without using the command object ?
thanks

推荐答案

实际上它很安静

i做了一些尝试并发现了这种方式:

1 - 右键单击​​数据源中的数据集并使用向导配置它以从底层数据库添加udf

2-现在你可以使用这样的queriesTableAdapter直接使用udf:

actually it is quiet possible
i did some tries and found this way :
1-right click on the dataset in the datasources and configure it with wizard to add the udf from the underlying database
2-now you can use the udf directly by using the queriesTableAdapter like this :
Dim da As New DataSetTableAdapters.QueriesTableAdapter
        s = da.getItemBalance(i)




我很难找到答案(3小时的谷歌搜索是徒劳的)

所以我想与每个人分享解决方案



感谢每一个身体



it was just so hard for me to find the answer (3 hours of googling in vain)
so i thought to share the solution with every one

thanks every body


这篇关于如何直接从数据集调用Sql Udf?它甚至可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆