Project wont compile

namecaf
08-31-2003, 07:39 PM
I've made a synchronisation program that works in the IDE fine but just wont compile. There's no errors in the code, but when I try to make an .exe the compiler just hangs.

I've uploaded a copy of the project source and database to the net, anyone want to have a look at it and work out what's wrong with it? I'm totally stumped.

It's up at http://www.geocities.com/macfinncool

passel
08-31-2003, 08:54 PM
I don't think that it is hung, it just takes a very long time to compile
because (I assume) of the large number of literal strings that you have in the
program.

I tried to isolate the problem by copying out all your routines, and then
adding them back one by one, and creating an executable after each
addition. The compile time with one of the routines in there was taking
5 seconds. The times grew until it was a little over 40 seconds for all
but the last routine (Job Brief). Then it ran for almost 2 minutes before
I killed it. I put in Job Brief by itself, and I killed it after about a 1.5
minutes.
I then started adding each of the Job Brief cases in, and saw after a
few of them were added, the compile times got quickly longer.
So once I had a feel for it, I put all the Job Brief cases in, and Job Brief
by itself took around 2 minutes and 20 seconds to compile.

So I added all the code back, and it took a total of around 2 minutes
and 40 seconds to compile.

I know nothing about databases, so I don't know if there's a better way
to go about this. My gut feeling is that it has to be all these Literal
Strings, that slows the compilation down.

So that's around 00:02:40 on a Pentium4 2.0 ghz with 512 MB memory.

Thinker
08-31-2003, 08:57 PM
I couldn't compile it either until I commented out all the long string of
If Then ElseIf Else in JobBrief. That code is way too long for C2.EXE to
compile quickly. I expect if I had given it an hour or so to work it would
have finally finished but there wasn't any point.

passel
08-31-2003, 09:31 PM
I'm not a database guy so I don't know, but it seems like if you could
replace the literal strings with variables, then you could also remove all
the redundant code by creating a sub to do the test and swap of your
records, like the example below.

Private Sub SyncRecord(Str1 As String, Str2 As String)
If rstAtGush(Str1) > rstOnline(Str1) Then
rstOnline(Str2) = rstAtGush(Str2)
rstOnline(Str1) = rstAtGush(Str1)
ElseIf rstOnline(Str1) > rstAtGush(Str1) Then
rstAtGush(Str2) = rstOnline(Str2)
rstAtGush(Str1) = rstOnline(Str1)
End If
End Sub

Private Sub Supplier()
cmdAtGush.CommandText = "SELECT * FROM supplier ORDER BY supp_id"
rstAtGush.Open cmdAtGush
rstAtGush.MoveFirst
cmdOnline.CommandText = "SELECT * FROM supplier ORDER BY supp_id"
rstOnline.Open cmdOnline
rstOnline.MoveFirst

While Not rstAtGush.EOF = True
SyncRecord "sup_name_sdate", "name"
SyncRecord "sup_address_sdate", "address"
SyncRecord "sup_suburb_sdate", "suburb"
SyncRecord "sup_postcode_sdate", "postcode"
SyncRecord "sup_state_sdate", "state"
SyncRecord "sup_telephone_sdate", "telephone"
SyncRecord "sup_fax_sdate", "fax"
SyncRecord "sup_mobile_sdate", "mobile"
SyncRecord "sup_email_sdate", "email"
SyncRecord "sup_web_address_sdate", "web_address"

rstAtGush.MoveNext
rstOnline.MoveNext
Wend

rstAtGush.Close
rstOnline.Close
End Sub

P.S. Removing all the empty "Else ' " cases seemed to cut a few seconds
off the compile time, although I had already removed them from JobBrief
so don't know what the total savings was, probably only about 10 to 15
seconds or so.

P.S.S After changing the 45 cases in JobBrief to use sub SyncRecord (used
UltraEdit macro in another editor to pull the strings, and create the lines
so I didn't have to manually do it), the compile only took about 19 seconds. Could probably cut that to less than half if the rest of the
routines were done.

namecaf
09-02-2003, 03:47 AM
Thanks passel, I tried doing it your way and it finally does compile. Thanks again. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum