Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
Richard C Bishop 10-Feb-14 17:24pm    
I seriously doubt it. How else will the application get access to the database?
[no name] 10-Feb-14 17:34pm    
If you are using EF then you can map this in your EF model, Still it would probably use command object behind the scenes.

1 solution

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 :
VB
Dim da As New DataSetTableAdapters.QueriesTableAdapter
        s = da.getItemBalance(i)


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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900