ASP DLL PROBLEM....HELP!!!!
-
I am having a problem with a server side component (DLL) i am developing for an ASP page. Im not really sure what the problem is. I tested the code in a vbproject and it worked perfectly but when I try it in an ASP page, it doesnt work. ************************************************************** My ASP page looks like this <%@ Language=VBScript %> <% dim obj set obj = server.CreateObject("Danny.Lopez") Response.Write(obj.GetTeam(1)) %>
*************************************************************** This is the error im getting Error Type: Danny (0x800A01A8) Object required /Project1/Registration.asp, line 10 *************************************************************** This is some of the the code in my ActiveX DLL Public Function GetTeam(TeamID As Integer) As String Dim sql As String sql = "SELECT Name FROM Teams WHERE TeamID = " & TeamID GetTeam = ExecuteQuery(sql, True)(0) End Function Private Function ExecuteQuery(sql As String, Optional CloseConnection As Boolean = False) As ADODB.Recordset Dim state As Integer state = DataEnvironment1.Connection1.state If state = 0 Then DataEnvironment1.Connection1.Open End If Dim rs As ADODB.Recordset Set rs = DataEnvironment1.Connection1.Execute(sql) Set ExecuteQuery = rs If state = 0 And Not CloseConnection Then DataEnvironment1.Connection1.Close End If End Function *************************************************************** To make sure the DLL worked at all in the ASP page I created a simple function that takes a string and returns it. Public Function Repeat(str As String) As String Repeat = str End Function This function worked in an ASP pef *************************************************************** I feel the error has to do with the data types im passing to my DLL, but im not sure. Please Help!!!! Thanks Danny :((
-
I am having a problem with a server side component (DLL) i am developing for an ASP page. Im not really sure what the problem is. I tested the code in a vbproject and it worked perfectly but when I try it in an ASP page, it doesnt work. ************************************************************** My ASP page looks like this <%@ Language=VBScript %> <% dim obj set obj = server.CreateObject("Danny.Lopez") Response.Write(obj.GetTeam(1)) %>
*************************************************************** This is the error im getting Error Type: Danny (0x800A01A8) Object required /Project1/Registration.asp, line 10 *************************************************************** This is some of the the code in my ActiveX DLL Public Function GetTeam(TeamID As Integer) As String Dim sql As String sql = "SELECT Name FROM Teams WHERE TeamID = " & TeamID GetTeam = ExecuteQuery(sql, True)(0) End Function Private Function ExecuteQuery(sql As String, Optional CloseConnection As Boolean = False) As ADODB.Recordset Dim state As Integer state = DataEnvironment1.Connection1.state If state = 0 Then DataEnvironment1.Connection1.Open End If Dim rs As ADODB.Recordset Set rs = DataEnvironment1.Connection1.Execute(sql) Set ExecuteQuery = rs If state = 0 And Not CloseConnection Then DataEnvironment1.Connection1.Close End If End Function *************************************************************** To make sure the DLL worked at all in the ASP page I created a simple function that takes a string and returns it. Public Function Repeat(str As String) As String Repeat = str End Function This function worked in an ASP pef *************************************************************** I feel the error has to do with the data types im passing to my DLL, but im not sure. Please Help!!!! Thanks Danny :((
DanielLopez wrote: Public Function GetTeam(TeamID As Integer) As String Dim sql As String sql = "SELECT Name FROM Teams WHERE TeamID = " & TeamID GetTeam = ExecuteQuery(sql, True)(0) End Function Rewrite the above function as ... Public Function GetTeam(TeamID As Integer) As String Dim sql As String Dim rs as ADODB.Recordset sql = "SELECT Name FROM Teams WHERE TeamID = " & TeamID set rs = ExecuteQuery(sql, True) GetTeam = rs.Fields(0) End Function :) Grant @ Loki