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 = "<table align=center border=1 cellpadding=2 cellspacing=3>"
strTable = strTable & "<tr><th>Company</th><th>Model</th></tr><tr>"
While Not (MyRS.EOF)
strTable = strTable & "<tr>"
strTable = strTable & "<td>" & MyRS("Name" & "</td><td>" & MyRS("Model" & "</td>"
strTable = strTable & "<td>" & MyRS("Color" & "</td><td>" & MyRS("Price" & "</td>"
strTable = strTable & "</tr>"
MyRS.MoveNext
Wend
strTable = strTable & "</table>"
MyResponse.Write (strTable)
End If
Dim strForm
strForm = "<form name=frmCar action=MyCar.asp?qs=1 method=post>"
strForm = strForm & "Name: <input type=text name=txtName><BR>"
strForm = strForm & "Model: <input type=text name=txtModel><BR>"
strForm = strForm & "Color: <input type=text name=txtColor><BR>"
strForm = strForm & "Price: <input type=text name=txtPrice><BR>"
strForm = strForm & "<input type=submit value=Submit><BR>"
strForm = strForm & "</form>"
MyResponse.Write (strForm)
End Sub
-----------
asp coding
~~~~~~~~~~
<%
dim objCar
Set ObjCar = Server.CreateObject("CarComponent.MyCar"
objCar.ProcessForm
%>
-------------
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 = "<table align=center border=1 cellpadding=2 cellspacing=3>"
strTable = strTable & "<tr><th>Company</th><th>Model</th></tr><tr>"
While Not (MyRS.EOF)
strTable = strTable & "<tr>"
strTable = strTable & "<td>" & MyRS("Name" & "</td><td>" & MyRS("Model" & "</td>"
strTable = strTable & "<td>" & MyRS("Color" & "</td><td>" & MyRS("Price" & "</td>"
strTable = strTable & "</tr>"
MyRS.MoveNext
Wend
strTable = strTable & "</table>"
MyResponse.Write (strTable)
End If
Dim strForm
strForm = "<form name=frmCar action=MyCar.asp?qs=1 method=post>"
strForm = strForm & "Name: <input type=text name=txtName><BR>"
strForm = strForm & "Model: <input type=text name=txtModel><BR>"
strForm = strForm & "Color: <input type=text name=txtColor><BR>"
strForm = strForm & "Price: <input type=text name=txtPrice><BR>"
strForm = strForm & "<input type=submit value=Submit><BR>"
strForm = strForm & "</form>"
MyResponse.Write (strForm)
End Sub
-----------
asp coding
~~~~~~~~~~
<%
dim objCar
Set ObjCar = Server.CreateObject("CarComponent.MyCar"
objCar.ProcessForm
%>
-------------