473,657 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a UserDefined Function

31 New Member
Does anyone know how to call a UserDefined Function written in SQL 2000 from program(I mean I am writing code in VB.net)..I know how to call it from a stored proc. but don't know how to call from my prog. Like we call stored proc.
Thnks
Apr 23 '09 #1
2 1684
Delerna
1,134 Recognized Expert Top Contributor
I haven't actually tried it with a UDF but I know you can call a stored proc from vbscript like this.

Expand|Select|Wrap|Line Numbers
  1. str="exec YourProc Param1,Param2"
  2. objRecordset.open objSQLServerConection,str
  3.  
Which is the standard way of executing an SP in SQL syntax.

so I suspect you might be able to call the UDF just like you would in any SQL server syntax method of calling a UDF

Expand|Select|Wrap|Line Numbers
  1. str="SELECT dbo.YourUDF(par1,par2)"
  2. objRecordset.open objSQLServerConection,str
  3.  
well, something like that .
And you will, of course, need to observe vb.net syntax
Apr 24 '09 #2
ck9663
2,878 Recognized Expert Specialist
If it's a scalar function, try re-creating it in your front-end. If it's a multi-lined, run it as ordinary T-SQL and monitor your result set. If it's a table-function, access it as if you're accessing a table or a view.

--- CK
Apr 24 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2953
by: Muthu | last post by:
I've read calling conventions to be the order(reverse or forward) in which the parameters are being read & understood by compilers. For ex. the following function. int Add(int p1, int p2, int p3); The parameters here can be read either in the forward order from p1 till p3 or reverse order from p3 till p1. Can anyone explain what is the advantage/disadvantage of either of
2
1656
by: parez | last post by:
Hi All! This is the first time i am tryin to write a sql server 2000 function. I need to clean up some of my stored procedures.. Can any one please give me skeleton for a userdefined function or correct my function. I get the following error. Select statements included within a function cannot return data to a client.
6
3304
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference in VBA from my other Access applications. This works fine and I'm quite happy with it... except for one area; error handling. In most of my functions I call an error handler which
14
2993
by: ericellsworth | last post by:
Hi, I'm trying to use a class to pass variables back and forth from a form opened in dialog mode. I have created a class which invokes a form in its show method, like so: Public Sub Show() ' This method shows the form used to get the info If sWhereInt = "" Then DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
4
2003
by: anthony.wolfe | last post by:
Hello all, I'm hoping that someone could help me with this bit of code. I am using reflection to dynamically call a method within an HttpHandler. When a method returns a user defined type that implements a certain interface, I want to call that interfaces method. The problem is that the local varaible holding the user defined type is declared an object. The compiler will accept the invocation of the interface method on that object. I...
15
22835
by: dspfun | last post by:
Hi, Is it possible to print the function name of the calling function? For example, f1() and f2() both calls f3(), in f3() I would like to print the name of the function calling f3() which could either be f1() or f2(). BRs!
6
3165
by: newlearner | last post by:
Hi, i know we can wirte a userdefined callback function.. I had a try for a long time though i feel im near but not able to coin out the exact thing. can any body tell me about a user defined callback function... and a sample on how to write it... looking forward for a reply.. Thanks in advance for your reply...
0
3046
by: =?Utf-8?B?a3Jpc2huYQ==?= | last post by:
Hi i am getting the following error while using XMLSerializer XmlSerializer ser = new XmlSerializer(typeof(Person)); ERROR: Unable to generate a temporary class (result=1). error CS0266: Cannot implicitly convert type 'XSD.BiodataGender?' to 'XSD.BiodataRace?'. An explicit conversion exists (are you missing a cast?) I am getting the above error when my xsd has multiple nillable elements of userdefined type. If I change the type of...
1
4453
by: vijaya Lakshmi | last post by:
Hi , We are trying to convert stored procedures from mssql to mysql as a part of db migration, and we are facing the following issue. In mssql , business exceptions can be raised by using RAISERROR function as given below CREATE PROCEDURE dbo.NEXT_SEQ_VAL(@seqName VARCHAR(100),@increment int = 1) AS BEGIN DECLARE @NSN int,
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.