Article View: be.comp.programming
Article #12091Re: Visual Basic Class
From: BlueScreen
Date: Fri, 14 Dec 2001 15:09
Date: Fri, 14 Dec 2001 15:09
362 lines
15065 bytes
15065 bytes
This is a multi-part message in MIME format.
------=_NextPart_000_0023_01C184B9.BC90FFC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Probleem is verholpen
Ik had in class1 class 2 niet gedefinieerd
Dim Objcls2 as cls2
set Objcls2 =3D New cls2
Thanks BlueScreen
"BlueScreen" <helsenwerner_None_@skynet.be> schreef in bericht =
news:3c19f6c4$0$385$ba620e4c@news.skynet.be...
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
------=_NextPart_000_0023_01C184B9.BC90FFC0
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 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Probleem is verholpen</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Ik had in class1 class 2 niet=20
gedefinieerd</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Dim Objcls2 as cls2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>set Objcls2 =3D New =
cls2</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks BlueScreen</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV>"BlueScreen" <<A=20
=
href=3D"mailto:helsenwerner_None_@skynet.be">helsenwerner_None_@skynet.be=
</A>>=20
schreef in bericht <A=20
=
href=3D"news:3c19f6c4$0$385$ba620e4c@news.skynet.be">news:3c19f6c4$0$385$=
ba620e4c@news.skynet.be</A>...</DIV>
<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 =
<STRONG>cls2.GetRecordSet</STRONG>(str_SQL, objRS, dcErrNr, dcErrDesc) =
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> =
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> =
=20
Set objRS =3D Nothing<BR> <BR> =20
Else<BR> =20
ErrNr =3D=20
dcErrNr<BR> =
=20
ErrDisc =3D dcErrDesc<BR> =20
CheckUser =3D False<BR> =
=20
End 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=20
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=20
GoTo 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> =20
ErrDesc =3D dcErrDesc<BR> =20
GetRecordSet =3D=20
False<BR> =
Exit=20
Function<BR> End =
If<BR> =20
<BR> objRS.Open SQL, =
ObjConnection,=20
adOpenDynamic, adLockReadOnly<BR> =
GetRecordSet =3D True<BR> Exit=20
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> =20
Dim 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> =
=20
Exit 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=20
Function</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0023_01C184B9.BC90FFC0--
Technical Details
Message-ID:
<3c1a1684$0$10332$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> <3c19f6c4$0$385$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 07:11:03 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> <3c19f6c4$0$385$ba620e4c@news.skynet.be> Subject: Re: Visual Basic Class Date: Fri, 14 Dec 2001 16:09:41 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0023_01C184B9.BC90FFC0" 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: 363 Message-ID: <3c1a1684$0$10332$ba620e4c@news.skynet.be> Organization: -= Skynet Usenet Service =- NNTP-Posting-Host: 217.136.109.216 X-Trace: 1008342661 reader0.news.skynet.be 10332 217.136.109.216 X-Complaints-To: abuse@skynet.be