pcabrol
May 7th, 2001, 02:14 PM
I'm compiling this code as a dll to run in MTS..I've created a simple ASP page to run a simple update or save method..not sure if my code is correct but I receive a type mistmatch error.
here's how it looks in ASP
<%@ Language=VBScript %>
<%
Set obj=Server.CreateObject("CorpHighYield.company")
obj.UpdateCompany "Revlon", "REVLN", "11"
%>
Error message I receive:
Public Function UpdateCompany(CompanyName As Long, BondTicker As Long, IndustryID As Integer, Optional CompanyID As Integer)
Dim rsCompany As ADODB.Connection, sSQL As String, objDB As Object, stat As Long
On Error GoTo ErrorHandler
'** Create instance of the database engine object
Set objDB = GetObjectContext.CreateInstance("MTSBaDbEngine.Engine")
If Not IsMissing(CompanyID) Then
'** Build query to update Company Name
sSQL = "update HighYieldCompany set CompanyName= " & CompanyName
sSQL = sSQL & "where companyID=" & CompanyID
ElseIf Not IsMissing(CompanyID) Then
'** Build query to update BondTicker
sSQL = "update HighYieldCompany set BondTicker= " & BondTicker
sSQL = sSQL & "where companyID=" & CompanyID
Else
If Not IsMissing(CompanyID) Then
sSQL = "insert into HighYieldCompany(CompanyName, BondTicker, FK_IndustryID) values(" & _
CompanyName & ", '" & BondTicker & "','" & IndustryID & "')"
If Not stat = 0 Then
'** Build query to insert new record
sSQL = "insert into HighYieldCompany(CompanyName, BondTicker, FK_IndustryID) values(" & _
CompanyName & ", '" & BondTicker & "','" & IndustryID & "')"
End If
stat = objDB.Execquery(sSQL)
End If
End If
'** Execute query
Call objDB.Execquery(sSQL)
'** Create recordset and pass back to client
Set UpdateCompany = rsCompany
Set objDB = Nothing
GetObjectContext.SetComplete
Exit Function
ErrorHandler:
GetObjectContext.SetAbort
Err.Raise Number:=Err.Number, Description:=Err.Description, _
Source:=LIBRARY_NAME & "::" & CLASS_NAME & ".UpdateCompany()"
here's how it looks in ASP
<%@ Language=VBScript %>
<%
Set obj=Server.CreateObject("CorpHighYield.company")
obj.UpdateCompany "Revlon", "REVLN", "11"
%>
Error message I receive:
Public Function UpdateCompany(CompanyName As Long, BondTicker As Long, IndustryID As Integer, Optional CompanyID As Integer)
Dim rsCompany As ADODB.Connection, sSQL As String, objDB As Object, stat As Long
On Error GoTo ErrorHandler
'** Create instance of the database engine object
Set objDB = GetObjectContext.CreateInstance("MTSBaDbEngine.Engine")
If Not IsMissing(CompanyID) Then
'** Build query to update Company Name
sSQL = "update HighYieldCompany set CompanyName= " & CompanyName
sSQL = sSQL & "where companyID=" & CompanyID
ElseIf Not IsMissing(CompanyID) Then
'** Build query to update BondTicker
sSQL = "update HighYieldCompany set BondTicker= " & BondTicker
sSQL = sSQL & "where companyID=" & CompanyID
Else
If Not IsMissing(CompanyID) Then
sSQL = "insert into HighYieldCompany(CompanyName, BondTicker, FK_IndustryID) values(" & _
CompanyName & ", '" & BondTicker & "','" & IndustryID & "')"
If Not stat = 0 Then
'** Build query to insert new record
sSQL = "insert into HighYieldCompany(CompanyName, BondTicker, FK_IndustryID) values(" & _
CompanyName & ", '" & BondTicker & "','" & IndustryID & "')"
End If
stat = objDB.Execquery(sSQL)
End If
End If
'** Execute query
Call objDB.Execquery(sSQL)
'** Create recordset and pass back to client
Set UpdateCompany = rsCompany
Set objDB = Nothing
GetObjectContext.SetComplete
Exit Function
ErrorHandler:
GetObjectContext.SetAbort
Err.Raise Number:=Err.Number, Description:=Err.Description, _
Source:=LIBRARY_NAME & "::" & CLASS_NAME & ".UpdateCompany()"