Article View: be.comp.programming
Article #12090Re: Visual Basic Class
From: BlueScreen
Date: Fri, 14 Dec 2001 12:54
Date: Fri, 14 Dec 2001 12:54
378 lines
16092 bytes
16092 bytes
This is a multi-part message in MIME format.
------=_NextPart_000_0030_01C184A6.C9A47380
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hier is de code
In het Project prjDll wordt vanuit Classe1 (cls1.cls) de functie =
CheckUser aangeroepen van buitenuit(standard.exe),
deze functie roept op haar beurt de functie GetRecordSet aan welke zich =
bevindt in Classe 2(cls2.cls).
Hier treed vervolgens de fout op (GetRecordSet Public of Friend blijft =
hetzelfde).
foutmelding
Compile error
variable not defined
Thank you, BlueScreen.
prjDll
------
Classe 1 naam: cls1.cls
----------------------------
Public Function CheckUser(ErrNr As Long, ErrDesc As String) As =
Boolean
=20
Dim objRS as ADODB.RecordSet
Set objRS =3D New ADODB.Recordset
=20
str_SQL =3D "SELECT Name, FirstName, Password, Job, Login" _
& " FROM Users, Jobs" _
& " WHERE jobid =3D Id" _
& " AND Login =3D""" & m_strUserID & """"
=20
If cls2.GetRecordSet(str_SQL, objRS, dcErrNr, dcErrDesc) Then
If Not objRS.BOF =3D True And Not objRS.EOF =3D True Then
objRS.MoveFirst
=20
If objRS.Fields(2).Value =3D m_strPassword Then
ErrNr =3D ErrNr_None
ErrDesc =3D ErrDesc_None
CheckUser =3D True
Else
ErrNr =3D vbObjectError + ErrNr_3001
ErrDisc =3D ErrDesc_3001
CheckUser =3D False
End If
Else
ErrNr =3D vbObjectError + ErrNr_3000
ErrDisc =3D ErrDesc_3000
CheckUser =3D False
End If
=20
objRS.Close
Set objRS =3D Nothing
=20
Else
ErrNr =3D dcErrNr
ErrDisc =3D dcErrDesc
CheckUser =3D False
End If
End Function
Class 2 naam: cls2.cls
-------------------------
Dim objConnection as ADODB.Connection
(Friend) Public Function GetRecordSet(ByVal SQL As String, objRS As =
ADODB.Recordset, ErrNr As Long, ErrDesc As String) As Boolean
On Error GoTo ErrGetRecordSet
If Not ConnectMovies(dcErrNr, dcErrDesc) Then
ErrNr =3D dcErrNr
ErrDesc =3D dcErrDesc
GetRecordSet =3D False
Exit Function
End If
=20
objRS.Open SQL, ObjConnection, adOpenDynamic, adLockReadOnly
GetRecordSet =3D True
Exit Function
=20
ErrGetRecordSet:
ErrNr =3D Err.Number
ErrDesc =3D Err.Description
GetRecordSet =3D False
End Function
Private Function Connect(ErrNr As Long, ErrDesc As String) As =
Boolean
On Error GoTo ErrConnect
Dim strPath As String
strPath =3D App.Path + "\Movies2000.mdb"
Set ObjConnection =3D New ADODB.Connection
=20
ObjConnection.Open "provider=3DMicrosoft.Jet.OLEDB.4.0;Data =
Source=3D" & strPath & ";Persist Security Info=3DFalse"
=20
Connect =3D True
Exit Function
=20
ErrConnect:
ErrNr =3D Err.Number
ErrDisc =3D Err.Description
Connect =3D False
Exit Function
End Function
"Frank Eersels" <frank.eersels@skynet.be> schreef in bericht =
news:3c19ba27$0$195$ba620e4c@news.skynet.be...
> Code graag...
>=20
> Frank
>=20
> "BlueScreen" <helsenwerner_None_@skynet.be> wrote in message
> news:3c19668b$0$181$ba620e4c@news.skynet.be...
> > Hallo allemaal,
> >
> > Ik heb een vraag ivm class.
> >
> > Ik heb een ActiveX dll project met 2 classes:
> > in classe 1 staat een Functie GetRecordSet.
> > in classe 2 wordt deze functie als volgd aangeroepen
> > className.FunctionName().
> >
> > Dit geeft nu de volgende Error Compile error
> > variable not defined
> >
> > Weet iemand een oplossing.
> >
> > Dank U, BlueScreen
> >
> >
>=20
>=20
------=_NextPart_000_0030_01C184A6.C9A47380
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hier is de code</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>In het Project prjDll wordt vanuit =
Classe1=20
(cls1.cls) de functie <STRONG>CheckUser </STRONG>aangeroepen van=20
buitenuit(standard.exe),</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>deze functie roept op haar beurt de =
functie=20
GetRecordSet aan welke zich bevindt </FONT><FONT face=3DArial =
size=3D2>in Classe=20
2(cls2.cls).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Hier treed vervolgens de fout op =
(GetRecordSet=20
Public of Friend blijft hetzelfde).</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
foutmelding</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> Compile=20
error<BR> vari=
able=20
not defined<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank yo</FONT><FONT face=3DArial =
size=3D2>u,=20
BlueScreen.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>prjDll</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> <STRONG>Classe=20
1 naam: cls1.cls</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
----------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Public Function=20
<STRONG>CheckUser</STRONG>(ErrNr As Long, ErrDesc As String) As=20
Boolean<BR> </FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> Dim objRS as=20
ADODB.RecordSet<BR> Set objRS =
=3D New=20
ADODB.Recordset<BR> <BR> =
=20
str_SQL =3D "SELECT Name, FirstName, Password, Job, Login"=20
_<BR> &n=
bsp;=20
& " FROM Users, Jobs"=20
_<BR> &n=
bsp;=20
& " WHERE jobid =3D Id"=20
_<BR> &n=
bsp;=20
& " AND Login =3D""" & m_strUserID &=20
""""<BR> <BR> If=20
<STRONG>cls2.GetRecordSet</STRONG>(str_SQL, objRS, dcErrNr, dcErrDesc)=20
Then<BR> If =
Not=20
objRS.BOF =3D True And Not objRS.EOF =3D True=20
Then<BR>  =
;=20
=20
objRS.MoveFirst<BR> =
=20
<BR> =20
If objRS.Fields(2).Value =3D m_strPassword=20
Then<BR>  =
; =20
ErrNr =3D=20
ErrNr_None<BR>  =
; =20
ErrDesc =3D=20
ErrDesc_None<BR> &nb=
sp; =20
CheckUser =3D=20
True<BR>  =
;=20
=20
Else<BR>  =
; =20
ErrNr =3D vbObjectError +=20
ErrNr_3001<BR>  =
; =20
ErrDisc =3D=20
ErrDesc_3001<BR> &nb=
sp; =20
CheckUser =3D=20
False<BR> &nbs=
p;=20
End If<BR> =20
=20
Else<BR>  =
; =20
ErrNr =3D vbObjectError +=20
ErrNr_3000<BR>  =
; =20
ErrDisc =3D=20
ErrDesc_3000<BR> &nb=
sp; =20
CheckUser =3D=20
False<BR> =
End=20
If<BR> =
<BR> =20
objRS.Close<BR> =
Set=20
objRS =3D Nothing<BR> <BR> =
=20
Else<BR> =
ErrNr =3D=20
dcErrNr<BR> =
ErrDisc=20
=3D dcErrDesc<BR> =
=20
CheckUser =3D False<BR> End=20
If<BR> End Function</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> <STRONG>Class 2=20
naam: cls2.cls</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> =20
-------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Dim objConnection as =
ADODB.Connection</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> (Friend) Public =
Function=20
<STRONG>GetRecordSet</STRONG>(ByVal SQL As String, objRS As =
ADODB.Recordset,=20
ErrNr As Long, ErrDesc As String) As Boolean<BR> On =
Error GoTo=20
ErrGetRecordSet</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
If Not=20
ConnectMovies(dcErrNr, dcErrDesc)=20
Then<BR> =
ErrNr =3D=20
dcErrNr<BR> =
ErrDesc=20
=3D dcErrDesc<BR> =
=20
GetRecordSet =3D False<BR> =20
Exit Function<BR> =
End=20
If<BR> <BR> =
objRS.Open=20
SQL, ObjConnection, adOpenDynamic, adLockReadOnly<BR> =20
GetRecordSet =3D True<BR> =
=20
Exit Function<BR> <BR> =20
ErrGetRecordSet:<BR> ErrNr =3D=20
Err.Number<BR> ErrDesc =3D=20
Err.Description<BR> GetRecordSet =
=3D=20
False<BR> End Function</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> Private Function=20
<STRONG>Connect</STRONG>(ErrNr As Long, ErrDesc As String) As=20
Boolean<BR> On Error GoTo =
ErrConnect<BR> Dim=20
strPath As String</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
strPath =3D=20
App.Path + "\Movies2000.mdb"<BR> =
Set=20
ObjConnection =3D New ADODB.Connection<BR> =20
<BR> ObjConnection.Open=20
"provider=3DMicrosoft.Jet.OLEDB.4.0;Data Source=3D" & strPath & =
";Persist=20
Security Info=3DFalse"<BR> <BR> =20
Connect =3D True<BR> =
Exit=20
Function<BR> <BR> =20
ErrConnect:<BR> ErrNr =3D=20
Err.Number<BR> ErrDisc =3D=20
Err.Description<BR> Connect =3D=20
False<BR> Exit=20
Function<BR> End Function</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>"Frank Eersels" <</FONT><A=20
href=3D"mailto:frank.eersels@skynet.be"><FONT face=3DArial=20
size=3D2>frank.eersels@skynet.be</FONT></A><FONT face=3DArial =
size=3D2>> schreef in=20
bericht </FONT><A =
href=3D"news:3c19ba27$0$195$ba620e4c@news.skynet.be"><FONT=20
face=3DArial =
size=3D2>news:3c19ba27$0$195$ba620e4c@news.skynet.be</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> =
Code=20
graag...<BR>> <BR>> Frank<BR>> <BR>> "BlueScreen" =
<</FONT><A=20
href=3D"mailto:helsenwerner_None_@skynet.be"><FONT face=3DArial=20
size=3D2>helsenwerner_None_@skynet.be</FONT></A><FONT face=3DArial =
size=3D2>> wrote=20
in message<BR>> </FONT><A=20
href=3D"news:3c19668b$0$181$ba620e4c@news.skynet.be"><FONT face=3DArial=20
size=3D2>news:3c19668b$0$181$ba620e4c@news.skynet.be</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>> > Hallo allemaal,<BR>> ><BR>> > Ik =
heb een=20
vraag ivm class.<BR>> ><BR>> > Ik heb een ActiveX dll =
project met 2=20
classes:<BR>> > in classe 1 staat een Functie=20
GetRecordSet.<BR>> > in classe 2 wordt deze functie =
als volgd=20
aangeroepen<BR>> > className.FunctionName().<BR>> ><BR>> =
> Dit=20
geeft nu de volgende Error Compile error<BR>>=20
> &nb=
sp; &nbs=
p;  =
; =
=20
variable not defined<BR>> ><BR>> > Weet iemand een=20
oplossing.<BR>> ><BR>> > Dank U, BlueScreen<BR>> =
><BR>>=20
><BR>> <BR>> </FONT></BODY></HTML>
------=_NextPart_000_0030_01C184A6.C9A47380--
Technical Details
Message-ID:
<3c19f6c4$0$385$ba620e4c@news.skynet.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!skynet.be!skynet.be!louie!not-for-mailReferences:
<3c19668b$0$181$ba620e4c@news.skynet.be> <3c19ba27$0$195$ba620e4c@news.skynet.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,486df1e2dd02e49 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2001-12-14 05:20:06 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!skynet.be!skynet.be!louie!not-for-mail From: "BlueScreen" <helsenwerner_None_@skynet.be> Newsgroups: be.comp.programming References: <3c19668b$0$181$ba620e4c@news.skynet.be> <3c19ba27$0$195$ba620e4c@news.skynet.be> Subject: Re: Visual Basic Class Date: Fri, 14 Dec 2001 13:54:02 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0030_01C184A6.C9A47380" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Lines: 379 Message-ID: <3c19f6c4$0$385$ba620e4c@news.skynet.be> Organization: -= Skynet Usenet Service =- NNTP-Posting-Host: 217.136.104.164 X-Trace: 1008334533 reader0.news.skynet.be 385 217.136.104.164 X-Complaints-To: abuse@skynet.be