Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is My Computer Too Fast?

Status
Not open for further replies.

spayne

Programmer
Feb 13, 2001
157
US
I have developed an application that, using ADO takes data from VFP6.0 tables and puts them into an Access2K database. It will also create new monthly tables in this Access database, when necessary. I developed it on a 233MHz PII and it runs perfectly fine. When I run it on a 933MHz PIII, it will create the tables, but will not insert the data. I have subsequently run the program on other computers with clock speeds inbetween these two, and it still runs fine. I only use one ADO connection (I hear that if you use two, it can affect read/write commands). Any suggestions or ideas?

Steve
 
I'd go out on a limb and say it probably doesnt have anything to do with the clock speed. We have several machines here that run at over 900 Mhz and no such problems have been reported....At least, not yet. ;-)

Does your code do any validation & error handling? It might be useful if you post the relevant code.

For Instance,

ON ERROR MESSAGEB("Where do u want to go today?",16,"Home")
oConnection=CREATEOBJECT('ADODB.Connection')
lnAffected=0
lcSQL="INSERT INTO Tbl1 SELECT * FROM Tbl2 WHERE [Fld]=1"
oConnection.Open("DSN=MyDSN")
IF oConnection.State = 1 && connected sucessfully
oConnection.Execute(lcSQL,@lnAffected)
IF lnAffected > 0
MESSAGEBOX("You da Monster.",16,"Monster.com")
ELSE
MESSAGEBOX("Ive fallen and I cant get up!",16,"911")
ENDIF
ELSE
MESSAGEBOX("Houston, we have a Problem!",16,"NASA")
ENDIF

Do you do any of the validation checks above (indicated in red) or does your code assume everything is peachy keen? Jon Hawkins
 
After your suggestion, I changed my code to this with no change in the results:


gcInsert1 = "INSERT INTO [" + gcToInfo + "] SELECT * FROM [info sheet]"
gcInsert2 = "INSERT INTO [" + gcToRes + "] SELECT * FROM [lab results]"

lAffected = .F.
ON ERROR DO createtables
oConn.Execute(gcInsert1)
IF NOT lAffected
oConn.Execute(gcInsert2)
ON ERROR
ENDIF


PROCEDURE createtables
ON ERROR

lcCreate1 = "SELECT * INTO [" + gcToRes + "] FROM [results back] WHERE False"
lcCreate2 = "SELECT * INTO [" + gcToInfo + "] FROM [info back] WHERE False"

oConn.Execute(lcCreate1)
oConn.Execute(lcCreate2)

oConn.Execute(gcInsert1)
oConn.Execute(gcInsert2)

lAffected = .T.
RETURN


Initially I didn't have the lAffacted variable. Also I had RETRY rather than RETURN in the procedure and kept the "Inserts" in the main program.
 
Here is an FYI for everyone interested. I guess I should explain that my code actually inserts VFP data into template Access tables and then into the appropriate monthly tables. I never have a problem with getting the data into the template table. It was getting it into the monthly tables. I solved this by closing the ADODB connection and reopening it between the two transfers. Works like a charm now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top