Click to See Complete Forum and Search --> : VB com object having problem in ASP


rshekhar
October 18th, 2001, 09:24 PM
Hi there,

I'm facing serious problem in ASP side.

I'm calling my own VB com object to update the user details to the database.

VB com object passing parameter data type is object. From ASP i'm try to pass the object to Update interface immediately
i'm getting error from the Browser that "data type mismatch"

----------------------------------------------------------------------------------------------------------------------------------------------
VB Com Channel Class input parameter object data type return boolean value for update Interface
----------------------------------------------------------------------------------------------------------------------------------------------

public Function update(objChannel as Object) as Boolean

Dim strSQL as string

on error GoTo errorhandler

update = false

If getDBConnection then

strSQL = "UPDATE channel " & _
"set description = '" & getSQLString(objChannel.Description) & "'," & _
"password = '" & getSQLString(objChannel.PassWord) & "'," & _
"id = '" & objChannel.ID & "'" & _
"WHERE system_id = " & CStr(mlngSystemId)

mcn.BeginTrans
mcn.Execute (strSQL)
mcn.CommitTrans

update = true

End If 'If getDBConnection

closeDB
Exit Function

errorhandler:
mlngErrNum = Err.Number
mstrErrDesc = Err.Description
update = false



---------------------------------------------------------------------------------------------------------------------------
VB Application code - this code is perfectly excuting and returning the boolean value
---------------------------------------------------------------------------------------------------------------------------

private Function updateChannel() as Boolean

Dim gobjTranzAdminMgr as object
Dim objChannel as Object
Dim mobjChannel as Object

on error GoTo errorhandler

updateChannel = false

set gobjTranzAdminMgr = CreateObject("MobiSoftMOE.AdminManager")

If Not gobjTranzAdminMgr is nothing then ' this is instanciated main class

set objChannel = gobjTranzAdminMgr.GetChannelClass
set mobjChannel =gobjTranzAdminMgr.GetChannelClass

if mobjChannel.Findbysystemid(lngsysid) then

objChannel.Description = txtDescription.Text
objChannel.id = mlngID
objChannel.Password = txtPassword.Text

If mobjChannel.Update(objChannel) then
updateChannel = true
else
gstrErrDes = mobjChannel.errordesc
End If
End if
set mobjChannel = nothing
set objChannel = nothing
End If
Exit Function

errorhandler:
gstrErrDes = Err.Description
glngErrNum = Err.Number
updateChannel = false

End Function



--------------------------------------------------------------------------------------------------------
ASP code - I'm unable to get the return value, its saying "Type Mismatch" of the update(objChannel)
--------------------------------------------------------------------------------------------------------

dim gobjTranzAdminMgr
dim objChannel
dim objChannelM
dim desc
dim id
dim sysid
dim pwd

desc = Request.Form("Description")
id = Request.Form("id")
sysid = Request.Form("sysid")
pwd= Request.Form("pwd")

set gobjTranzAdminMgr = server.CreateObject("MobiSoftMOE.AdminManager")

If Not gobjTranzAdminMgr is nothing then
set objChannelM = gobjTranzAdminMgr.GetChannelClass
set objChannel = gobjTranzAdminMgr.GetChannelClass

objChannel.Description = cstr(desc)
objChannel.id = clng(id)
objChannel.Password = cstr("pwd")

if objChannelM.FindbySystemid(clng(sysid)) then
if objChannelM.Update(objChannel) then <<<<<<<<<<<<<<<<<<< here i'm getting error "Type Mismatch">>>>>>>>>>>>>>>>>>>
Call Showmessage2("Channel " & msg_02, "ConChannleList.asp")
else
call Showmessage("error occured; " & objChannelM.errorDesc & msg_03 & " channel.")
Response.End
End If
End if
set objChannelM = nothing
set objChannel = nothing
end if
set gobjTranzAdminMgr = nothing



-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This com interface is working in VB application side, but not in ASP side.

Please help me.
Any kind of help or suggestion is appreciated

Thank You

Shekhar

TB_Guy_2000
October 19th, 2001, 09:18 AM
In vbscript, all datatypes are VARIANT. You can only pass a variant. Your dll parameters must also be variant.

This same thing caused me many problems as well.

Hope this helps.

TB_Guy_2000