All Forums >> [Scripting] >> ASP >> Access Custom Function in ASP Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I am having problems on an asp page. Basically this page is pulling a recordset from an Access database BUT on 1 field in the recordset I need to convert the data using a custom function on the database.
For example:
In the database I have a function: Function SQR(d as double) as Double SQR = d * d end function
In the ASP my SQL code is like: "select firstname,lastname, SQR(age) from employee"
On the ASP page it is complaining that the SQR function is undefine. How can I avoid this problem?
I have tried that to no success. The exact error message I received for a test is: Microsoft JET Database Engine (0x80040E14) Undefined function 'SQRt' in expression. /test/testfunction.asp, line 16
The code for test page is: <%@LANGUAGE="VBSCRIPT"%> <!--#include file="../Connections/dbConnections.asp" --> <% Function SQRt(d) SQRt = d * d end function
Dim Recordset1
Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = CON_REGULAR_SEASON Recordset1.Source = "SELECT tblMatchCard.MatchID,SQRt([RunsScored]) AS SQRrun, tblMatchCard.RunsScored FROM tblMatchCard;" Recordset1.CursorType = 3 Recordset1.CursorLocation = 3 Recordset1.Open()