Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error Code 50 with Subcode 5333

240 views
Skip to first unread message

Jürgen Knauf

unread,
Apr 15, 2014, 8:42:53 AM4/15/14
to
Hi,

I get often an Error Code 50 with Subcode 5333 on some machines. It occurs always in the search routine.

This the search routine:
****************************************
STATIC FUNCTION SqlSearch(dwParam) AS DWORD PASCAL
LOCAL dwRet AS DWORD
// LOCAL hConn AS DWORD
LOCAL cText, cBed AS STRING
LOCAL oSql AS AdsSQLServer
LOCAL oWin AS OBJECT
LOCAL cSuche,cFeld, cLastFeld AS STRING
LOCAL nTreffer AS DWORD
LOCAL cdbPfad,cDatei,cdbDatei AS STRING
LOCAL aExtract AS ARRAY

oWin := OBJECT(_CAST, dwParam)
cDatei := oWin:cdbDatei

aExtract := ExtractPath(cDatei)
cdbPfad := aExtract[1]
cdbDatei := aExtract[2]

IF glConnect == 0 // LocalServer
dwRet := AdsConnect60(cdbPfad, ADS_LOCAL_SERVER, "", "", 0,@glConnect)

IF dwRet <> 0
AdsShowError( "" )
RETURN
ENDIF

AX_SetConnectionHandle(glConnect)
ENDIF

Sleep(1000) //Damit am Anfang nicht beim ersten Buchstaben gesucht wird.
oWin:nKatNr := 0

DO WHILE !oWin:lExit
GetAppObject():Exec(EXECWHILEEVENT)

DO CASE
CASE Upper(RTrim(oWin:oDCGrpSuche:VALUE)) == "RDKURZ"
cFeld := "KUERZEL"
CASE Upper(RTrim(oWin:oDCGrpSuche:VALUE)) == "RDBEZ"
cFeld := "BEZ"
CASE Upper(RTrim(oWin:oDCGrpSuche:VALUE)) == "RDVOLLTEXT"
cFeld := "SEARCH"
CASE Upper(RTrim(oWin:oDCGrpSuche:VALUE)) == "RDSW"
cFeld := "SW"
ENDCASE

IF (Upper(RTrim(oWin:oDCSuche:CurrentText)) != Upper(cSuche) .OR. cFeld != cLastFeld) .AND. !Empty(oWin:oDCSuche:CurrentText)
cSuche := Upper(RTrim(oWin:oDCSuche:CurrentText))
cLastFeld := cFeld



IF cFeld == "SEARCH"

IF oWin:lSearchKat
cBed := "SELECT * from ["+ cdbDatei+ "] WHERE (contains (SEARCH, "+"'"+cSuche+"*')) AND parnr IN "+oWin:cSearchCat
ELSE
cBed := "SELECT * FROM ["+ cdbDatei+ "] where contains (SEARCH, "+"'"+cSuche+"*')"
ENDIF

ELSE

IF oWin:lSearchKat
cBed := "SELECT * FROM ["+ cdbDatei+ "] where (contains (Upper("+cFeld+"), "+"'"+cSuche+"*')) AND parnr IN "+oWin:cSearchCat
ELSE
cBed := "SELECT * FROM ["+ cdbDatei+ "] where contains (Upper("+cFeld+"), "+"'"+cSuche+"*')"
ENDIF

ENDIF

IF oWin:oCCrdBez:Pressed .AND. oWin:oCCrdVolltext:Pressed

IF oWin:lSearchKat
cBed := "SELECT * FROM ["+ cdbDatei+ "] where (contains (SEARCH, "+"'"+cSuche+"*') or contains (BEZ, "+"'"+cSuche+"*')) AND parnr IN "+oWin:cSearchCat
ELSE
cBed := "SELECT * FROM ["+ cdbDatei+ "] where contains (SEARCH, "+"'"+cSuche+"*') or contains (BEZ, "+"'"+cSuche+"*')"
ENDIF

ENDIF
oWin:oDcStatusSuche:CurrentText:= "Suche läuft"

oSql:= AdsSQLServer{cBed, , , "AXSQLADT" }

IF !oSql:Used
AdsShowError( "" )
RETURN
ENDIF

oSql:GoTop()

cText := ""
nTreffer := 0

oWin:oDClbSuche:Clear()

DO WHILE !oSql:EoF .AND. nTreffer < 100

IF Len(oSql:FIELDGET(#Bez)) > 0
oWin:oDClbSuche:AddItem(oSql:FIELDGET(#Bez),,oSql:FIELDGET(#NR))
ENDIF

IF Upper(RTrim(oWin:oDCSuche:CurrentText)) != Upper(cSuche)
EXIT
ENDIF

oSql:Skip()
nTreffer++
ENDDO

IF nTreffer < 100
oWin:oDcStatusSuche:CurrentText := "Suche abgeschlossen"
ELSE
oWin:oDcStatusSuche:CurrentText := "Es wurden mehr als 100 Treffer gefunden"
ENDIF

ELSE
IF Empty(oWin:oDCSuche:CurrentText)
oWin:oDClbSuche:Clear()
ENDIF
ENDIF

ENDDO

oSql:close()
oSql := NULL_OBJECT
oWin:lExit := FALSE

RETURN 0
****************************************

Any ideas?

Juergen

Jamal

unread,
Apr 15, 2014, 11:08:43 AM4/15/14
to
Jürgen,

>> oWin := OBJECT(_CAST, dwParam) <<

Since you do not say where exactly it is giving the error, start at top!

You are not checking if oWin is a valid object after casting dwParam.
Why not just the widow object instead of casting?

Jamal

"Jürgen Knauf" wrote in message
news:3e012240-0c6d-4a2d...@googlegroups.com...

Jürgen Knauf

unread,
Apr 15, 2014, 12:19:02 PM4/15/14
to
Aah. I will try it.

Thanks
Juergen

Jürgen Knauf

unread,
Apr 15, 2014, 12:23:22 PM4/15/14
to
>>Why not just the widow object instead of casting?
Because the calling function is CreateVOThread(...)

Here the Code:
******************

METHOD EditChange( oControlEvent ) CLASS Suchen
LOCAL oControl AS Control
LOCAL cKey AS STRING
LOCAL dwThreadID AS DWORD
LOCAL oSel AS Selection

oControl := IIF( oControlEvent == NULL_OBJECT, NULL_OBJECT, oControlEvent:Control )
SUPER:EditChange( oControlEvent )

IF oControl:NameSym == #SUCHE
cKey := Left(Upper(oDcSuche:CurrentText),1)

IF Instr("'",oDcSuche:CurrentText)
oSel := oDcSuche:Selection
oDcSuche:CurrentText := StrTran(oDcSuche:CurrentText,"'","")
oDcSuche:Selection := oSel
ENDIF

IF !Instr(cKey,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÖÄÜ") .AND. Len(oDcSuche:CurrentText) == 1
oDcSuche:CurrentText := Stuff(oDcSuche:CurrentText,1,1,"")
ELSE

IF SELF:lREady
oDClbSuche:TextColor := Color{COLORBLACK}
dwThreadID := 1001
SELF:ptrThread := CreateVOThread(NULL_PTR,0, @SqlSearch(), PTR(_CAST, SELF), 0, @dwThreadID )
SELF:lREady := FALSE
ENDIF

ENDIF

ENDIF


RETURN

************************



Am Dienstag, 15. April 2014 17:08:43 UTC+2 schrieb Jamal:

Karl Faller

unread,
Apr 15, 2014, 1:52:27 PM4/15/14
to
Jürgen.
>>>Why not just the widow object instead of casting?
>Because the calling function is CreateVOThread(...)
<Argh> - do you reeeaallly need a second thread for searching? I have
no deeper knowlegde of threading, but i doubt you can safely
"transport" a window over thread barriers, regardless if you "hide"
the object behind your numerical param...

Karl

Jamal

unread,
Apr 15, 2014, 3:32:26 PM4/15/14
to
Is a thread really needed?

Why not just call SqlSearch(Self) directly and update the function to handle
the owner object?

Jamal

"Jürgen Knauf" wrote in message
news:21173092-d1c2-4121...@googlegroups.com...

Mathias

unread,
Apr 16, 2014, 2:47:37 AM4/16/14
to
Jurgen,

I Think you should read the help texts about "Building a multithreaded web server with Visual Objects". Especially the part about thread synchronization. To access objects in the gui thread you have to use critical sections. You also have to read about dynamic memory management and the use of DynLock() and DynUnlock().

/Mathias

Jürgen Knauf

unread,
Apr 16, 2014, 5:05:04 AM4/16/14
to
I need the thread for simultaneously typing and searching. Like in a Google Search machine.

Karl Faller

unread,
Apr 16, 2014, 5:51:47 AM4/16/14
to
Jürgen,
>I need the thread for simultaneously typing and searching. Like in a Google Search machine.
no need for threads. Your sle fires changed events with every
keystroke, respond to it with your search routine...

Karl

Jürgen Knauf

unread,
Apr 16, 2014, 6:19:25 AM4/16/14
to

Am Mittwoch, 16. April 2014 11:51:47 UTC+2 schrieb Karl Faller:
> J�rgen,
I will try it.
Juergen

Jürgen Knauf

unread,
Apr 16, 2014, 7:34:30 AM4/16/14
to
Am Mittwoch, 16. April 2014 11:51:47 UTC+2 schrieb Karl Faller:
> J�rgen,
>
But while searching, I can't type.

JohnMartens

unread,
Apr 16, 2014, 6:58:17 AM4/16/14
to
Disable the controls which you want to keep unchanged during the thread
and issue a ExecWhileEvent every once in a while to let other pasrts of
your app do their job



Jürgen Knauf schreef op 16-4-2014 11:05:

Karl Faller

unread,
Apr 16, 2014, 11:45:47 AM4/16/14
to
Jürgen,
>But while searching, I can't type.
Is your search so slow?

Karl

Karl Faller

unread,
Apr 16, 2014, 1:45:19 PM4/16/14
to
Jürgen,
>> Is your search so slow?
>> Karl
>
>There is a Fulltext Search integrated. And it will slow down when there are some documents with more than 200 pages.
OK - but on the other hand, if you have to drill thus deep i wouldn't
expect any any incremental, "immediate" search. At minimum there will
be one complete word, probably more than one to look for...

And, what use will bring the threading here? You start (given the
timeoffset) probably with some 3 or 4 search chars, which will result
in a huge hit-list, only to drop ton's of them with any additional
character.

Karl

Carlos Rocha

unread,
Apr 16, 2014, 5:04:23 PM4/16/14
to
Jürgen,

> There is a Fulltext Search integrated. And it will slow down when there are
> some documents with more than 200 pages.

An ActiveX EXE might be a solution for you. It should be easier, and I
think you can create one with VO (not sure, tho).

--
Carlos Rocha

---
Este email está liivre de vírus e malware porque a proteção avast! Antivirus está ativa.
http://www.avast.com

Sherlock

unread,
Apr 16, 2014, 7:19:33 AM4/16/14
to
Juergen

snip[ I get often an Error Code 50 with Subcode 5333 on some machines. It occurs always in the search routine. ]

Just a couple of POSSIBLE things.. observations.

Does this function always return a 2 element array with string values?
aExtract := ExtractPath(cDatei)
cdbPfad := aExtract[1]
cdbDatei := aExtract[2]
--
oWin := OBJECT(_CAST, dwParam)
You do not check after this is NULL_OBJECT. Did it instantiate ?
--
CASE Upper(RTrim(oWin:oDCGrpSuche:VALUE)) == "RDKURZ"

Should this not be TEXTVALUE. Value without a FIELDSPEC of say "C" can cause weird issues.
---

Thats a start...

Phil

Jürgen Knauf

unread,
Apr 16, 2014, 12:16:59 PM4/16/14
to
Am Mittwoch, 16. April 2014 17:45:47 UTC+2 schrieb Karl Faller:
> J�rgen,
>
> >But while searching, I can't type.
>
> Is your search so slow?
>
>
>
> Karl

There is a Fulltext Search integrated. And it will slow down when there are some documents with more than 200 pages.

Juergen

Jürgen Knauf

unread,
Apr 17, 2014, 1:44:13 AM4/17/14
to
Thank you all for your tipps. I think I willfind a solution now.

Juergen

Jürgen Knauf

unread,
Apr 18, 2014, 5:55:19 AM4/18/14
to
I found a solution. I'm buffering the keystrokes. Then when I stop typing the search routine starts. There for I use the AfterDispatch method of the app class.
0 new messages