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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb - asp - DLL error 1

Status
Not open for further replies.

lee2k

Programmer
Aug 19, 2001
28
0
0
IN
hello,

i have created a dll in vb with a function
processform and registered using regsvr32.
when i am calling the function in asp using
server.createobject i am getting the following
error.
-----------------
CarComponent error '800a005b'
Object variable or With block variable not set
/portal/lenin/mycom/MyCar.asp
-----------------

i have restarted the machine after registering
the dll. after that too it's not working and giving
the same error.

the following are the code. please let me know how
to solve this problem.

vb coding:
~~~~~~~~~~
project name: CarComponent
class name: MyCar

Option Explicit

Private MyScriptingContext As ScriptingContext
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server

Public Sub ProcessForm()
Dim Path
Dim MyCon As ADODB.Connection
Path = MyServer.MapPath("/") & "\Vehicle.mdb"
MsgBox "Path: " & Path
MyCon.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Path

If CInt(MyRequest.QueryString("qs")) = 1 Then
Dim sqlString
sqlString = "INSERT INTO Vehicle VALUES("
sqlString = sqlString & "'" & MyRequest.Form("txtName") & "',"
sqlString = sqlString & "'" & MyRequest.Form("txtModel") & "',"
sqlString = sqlString & "'" & MyRequest.Form("txtColor") & "',"
sqlString = sqlString & MyRequest.Form("txtPrice") & ")"
MyCon.Execute sqlString
MsgBox "Data Inserted..."
End If

Dim MyRS As ADODB.Recordset
MyRS.Open "SELECT * FROM Vehicle", MyCon
If MyRS.BOF And MyRS.EOF Then
Else
Dim strTable
strTable = &quot;<table align=center border=1 cellpadding=2 cellspacing=3>&quot;
strTable = strTable & &quot;<tr><th>Company</th><th>Model</th></tr><tr>&quot;
While Not (MyRS.EOF)
strTable = strTable & &quot;<tr>&quot;
strTable = strTable & &quot;<td>&quot; & MyRS(&quot;Name&quot;) & &quot;</td><td>&quot; & MyRS(&quot;Model&quot;) & &quot;</td>&quot;
strTable = strTable & &quot;<td>&quot; & MyRS(&quot;Color&quot;) & &quot;</td><td>&quot; & MyRS(&quot;Price&quot;) & &quot;</td>&quot;
strTable = strTable & &quot;</tr>&quot;
MyRS.MoveNext
Wend
strTable = strTable & &quot;</table>&quot;
MyResponse.Write (strTable)
End If
Dim strForm
strForm = &quot;<form name=frmCar action=MyCar.asp?qs=1 method=post>&quot;
strForm = strForm & &quot;Name: <input type=text name=txtName><BR>&quot;
strForm = strForm & &quot;Model: <input type=text name=txtModel><BR>&quot;
strForm = strForm & &quot;Color: <input type=text name=txtColor><BR>&quot;
strForm = strForm & &quot;Price: <input type=text name=txtPrice><BR>&quot;
strForm = strForm & &quot;<input type=submit value=Submit><BR>&quot;
strForm = strForm & &quot;</form>&quot;
MyResponse.Write (strForm)
End Sub

-----------

asp coding
~~~~~~~~~~

<%
dim objCar
Set ObjCar = Server.CreateObject(&quot;CarComponent.MyCar&quot;)
objCar.ProcessForm
%>

-------------
 
Need to create your ADO objects as either:
dim oCN as NEW ADODB.Connection
or
dim oCN as ADODB.Connection
set oCN = New ADODB.Connection

also make sure you have set a refernce to MS Active Server Pages Object.
Hope this helps.
 
hi think the problem is with u r vb code ..u shld always bind variables
ur connection variable and the record set variable is not bound
u shoul either do early binding or late binding

try this in ur vb code

dim adocon as new adodb.connection
dim adors as new adodb.recordset

it shldnt give an error

cheers
 
hi,

i want to invoke a dll which is created in vb using active server pages library. even this simple component is not working, i am getting error. codings are given below. let me know how to solve. if anyone has some good samples send me thr' mail. i will be helpful.

VB Coding

project name: car
class name: mycar

Private MyResponse As Response

Public Sub ProcessForm()
Dim strForm
strForm = &quot;<form name=frmCar action=MyCar.asp?qs=1 method=post>&quot;
strForm = strForm & &quot;Name: <input type=text name=txtName><BR>&quot;
strForm = strForm & &quot;Model: <input type=text name=txtModel><BR>&quot;
strForm = strForm & &quot;Color: <input type=text name=txtColor><BR>&quot;
strForm = strForm & &quot;Price: <input type=text name=txtPrice><BR>&quot;
strForm = strForm & &quot;<input type=submit value=Submit><BR>&quot;
strForm = strForm & &quot;</form>&quot;
MyResponse.Write (strForm)
End Sub

after compiled this program into a dll i called in asp using the following code. but i am getting an error if i run that asp file.


ASP Coding

<%
dim objCar
Set ObjCar = Server.CreateObject(&quot;Car.MyCar&quot;)
objCar.ProcessForm
%>


the error message is:
Car error '800a005b'
Object variable or With block variable not set
/portal/lenin/mycom/MyCar.asp, line 7

bye
lenin
lenin_j@rediffmail.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top