Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MTS COM object Error On ASP page

Status
Not open for further replies.

jasonkslim

IS-IT--Management
Jul 13, 2000
1
MY
Hi ALL;<br>I have an COm object run on MTS/NT4 with IIS4 running. When i call this COM object from my ASP page, it's prompt me this error message :- (Please HELP /Advise as i have met my project deadline !!:( )<br><br>ComProject error '800a000d' <br>Type mismatch <br>/remisier/Csecurity1.asp, line 114 <br><br>My ComProject VB Code:<br>'Implements ObjectControl<br>' Compile Error : Object Module needs to implement 'CanBePooled' for interface 'ObjectControl'<br>' Failed to compile 'Implement ObjectControl' code statement and showing above mention message!<br>'Private objOContext<br>&nbsp;<br>Private Function getremisiercode(ByVal staff As Variant, ByVal newpassword As Variant) As Variant<br>&nbsp;&nbsp;&nbsp;&nbsp;On Error GoTo ErrCheck<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim objOContext As ObjectContext<br>&nbsp;&nbsp;&nbsp;&nbsp;Set objOContext = GetObjectContext()<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim sqltxt As String<br>&nbsp;&nbsp;&nbsp;&nbsp;sqltxt = &quot;Select remisiercode from employee where staffid='&quot; & staff & &quot;'&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;sqltxt = sqltxt & &quot; and password='&quot; & newpassword & &quot;'&quot;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim conn1 As ADODB.Connection<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim rs1 As ADODB.Recordset<br>&nbsp;&nbsp;&nbsp;&nbsp;Set conn1 = objOContext.CreateInstance(&quot;ADODB.Connection&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs1 = objOContext.CreateInstance(&quot;ADODB.Recordset&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;conn1.Open &quot;DRIVER=SQL Server;SERVER=SQL7;DATABASE=mbos_v109;UID=webuser;PASSWORD=webuser &quot;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs1 = conn1.Execute(sqltxt)<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;If rs1.EOF Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getremisiercode = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getremisiercode = rs1.Fields(&quot;remisiercode&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;objOContext.SetComplete<br>&nbsp;&nbsp;&nbsp;&nbsp;conn1.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;rs1.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;Set conn1 = Nothing<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rs1 = Nothing<br>&nbsp;&nbsp;&nbsp;&nbsp;Set objOContext = Nothing<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;ErrCheck:<br>&nbsp;&nbsp;&nbsp;&nbsp;GetObjectContext.SetAbort<br>&nbsp;&nbsp;&nbsp;&nbsp;Err.Raise Err.Number, Err.Source, Err.Description<br>End Function<br><br>My ASP Page Code:<br>&lt;%@ Language=VBScript transaction=Supported %&gt;<br>&lt;%dim remisiercode<br>Set loginid = Server.CreateObject(&quot;Comproject.ComMain&quot;)<br>set remisiercode = loginid.getremisiercode(staff,newpassword) %&gt;<br><br>THANKS IN ADVANCE <br><br>THANKS & Regards<br>Jason<br>
 
<br>&gt; set remisiercode = loginid.getremisiercode(staff,newpassword) %&gt;<br><br>Where are 'staff' and 'newpassword' coming from?<br><br>-pete
 
Hi Palbano ;<br>FYI.<br><br>dim staff<br>dim&nbsp;&nbsp;newpassword<br>staff = request.form(&quot;staffno&quot;)<br>newpassword = request.form (&quot;npassword&quot;)<br><br>TIA<br><br>TQ<br>Jason<br><br>
 
Dear Jason,<br><br>I'm not much good with VB or VBScript, but it is possible that this line:<br><br>set remisiercode = loginid.getremisiercode(staff,newpassword) <br><br>fails because you don't 'Set' a variant type or you don't 'Dim' a variant type in ASP.<br><br>Try both and see if one works.<br><br>Good luck<br>-pete
 
MTS automatically creates a context...<br>You dont have to use (or should Not I think)<br>objOContext.CreateInstance(&quot;ADODB.Connection&quot;)<br>just create it like<br><br>Public Sub DoStuff()&nbsp;&nbsp;&nbsp;<br>On Error Goto ErrHandler&nbsp;&nbsp;&nbsp;&nbsp;<br>Dim oConn As ADODB.Connection<br>Dim oCmd As ADODB.Command&nbsp;&nbsp;&nbsp;&nbsp;<br>Dim oRS As ADODB.Recordset<br>Set oConn = New ADODB.Connection&nbsp;&nbsp;&nbsp;&nbsp;<br>oConn.Open sConnectionString<br>&nbsp;&nbsp;&nbsp;&nbsp;'Here we specify cursor locations to adUseClient (3)<br>&nbsp;&nbsp;&nbsp;&nbsp;'because we will be reusing the connection afterwards<br>Set oCmd = New ADODB.Command&nbsp;&nbsp;&nbsp;&nbsp;<br>Set oCmd.ActiveConnection = oConn<br>oCmd.CommandText = &quot;SELECT * FROM Authors&quot;&nbsp;&nbsp;&nbsp;&nbsp;oCmd.CommandType = adCmdText<br>Set oRS= oCmd.Execute&nbsp;&nbsp;&nbsp;&nbsp;'...Operate on Recordset...<br>&nbsp;&nbsp;&nbsp;&nbsp;'...and we won't be needing it anymore so let's clean&nbsp;&nbsp;<br>oRS.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;Set oRS = Nothing&nbsp;&nbsp;&nbsp;&nbsp;Set oCmd = Nothing<br>&nbsp;&nbsp;&nbsp;&nbsp;oConn.Execute &quot;INSERT INTO Jobs (job_desc, min_lvl, max_lvl) values (&nbsp;&nbsp;&nbsp;&nbsp;'edjez',25,100 )&quot;<br>oConn.Close&nbsp;&nbsp;&nbsp;&nbsp;Set oConn = Nothing&nbsp;&nbsp;&nbsp;&nbsp;GetObjectContext.SetComplete<br>&nbsp;&nbsp;&nbsp;Exit Sub&nbsp;&nbsp;&nbsp;ErrHandler:&nbsp;&nbsp;&nbsp;&nbsp;GetObjectContext.SetAbort<br>&nbsp;&nbsp;&nbsp;&nbsp;Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile,&nbsp;&nbsp;&nbsp;&nbsp;Err.HelpContext<br>End Sub <br><br>
 
hi MartinE;<br>I wish using your method but i dunno how to pass back the recordset to use in ASP page. How do we pass the recordset result back to ASP ?<br>Thanks In Advance <br><br>ps: Palbano ! thanks for your advise !!!<br><br>regards<br>Jason<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top