Home > Archive > Visual Basic Syntax > March 2005 > Using sql user-defined function in vb6
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Using sql user-defined function in vb6
|
|
|
| I have a project that is connected to a sql server 2K database. Inside the
db I have udf's that I would like to access from within my vb6 application.
The udf's work just fine using sql query analyzer but, I can't seem to get
the correct syntax to use them in vb6. For instance, I would like to set the
text value in a text box to the value returned by a udf to sql. eg.
txtTotal.text = fn_Total_Value ('Visa', '3/5/2004'). I expect to send in the
variables and get back the answer.
Thanks
Ray
| |
| Jeff Johnson [MVP:VB] 2005-03-07, 4:09 pm |
|
"RayH" <RayH@discussions.microsoft.com> wrote in message
news:7ACB3E7F-6136-4783-AC1B-B4DCEF75C238@microsoft.com...
>I have a project that is connected to a sql server 2K database. Inside the
> db I have udf's that I would like to access from within my vb6
> application.
> The udf's work just fine using sql query analyzer but, I can't seem to get
> the correct syntax to use them in vb6. For instance, I would like to set
> the
> text value in a text box to the value returned by a udf to sql. eg.
> txtTotal.text = fn_Total_Value ('Visa', '3/5/2004'). I expect to send in
> the
> variables and get back the answer.
You'll only be able to access these functions in SQL queries you send to the
database. They're not visible as functions (as we know them) from within VB
itself.
| |
| dnagel 2005-03-07, 4:09 pm |
| IIRC, udf's are callable by standard SQL SELECT syntax...
strSQL = "Select fn_Total_Value ('" & strVisa & "', '" &
format(datCCDate,"mm-dd-yyyy") & "')"
Then pump that SQL into an RS object or a connection object that returns
a recordset to you...
D.
RayH wrote:
>I have a project that is connected to a sql server 2K database. Inside the
>db I have udf's that I would like to access from within my vb6 application.
>The udf's work just fine using sql query analyzer but, I can't seem to get
>the correct syntax to use them in vb6. For instance, I would like to set the
>text value in a text box to the value returned by a udf to sql. eg.
>txtTotal.text = fn_Total_Value ('Visa', '3/5/2004'). I expect to send in the
>variables and get back the answer.
>
>Thanks
>
>Ray
>
>
|
|
|
|
|