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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code minus 1

Status
Not open for further replies.

rianeiromiron

Programmer
Jul 1, 2001
151
GT
Hi all!!!

I need to retrieve data from a SQL database.
I have already established the connection, and I am able to copy the data in the sql table to one local table, using the following code

ConnStr = 'dsn=MYSQL;uid=myuser;pwd=mypassword'
Handle = SQLStringConnect( ConnStr )
SQLExec ( Handle, "SELECT * FROM MYTABLE" )
COPY TO MYLOCALTABLE

Something strange is happening:

Correct data is the following

PersonalCode Name
10 Peter
11 Erick
12 Travis
13 Elliot


and so on.....

on MYLOCALTABLE I get

PersonalCode Name
9 Peter
10 Erick
11 Travis
12 Elliot


So, the codes I get are the real codes minus 1.

Any ideas on what's going on?
 
One thing else:

This seems to be affecting only those records whose Code
is greater than 9999. I wonder if it has something to do with the resulting table (the temp sql file created by fox) which length is an integer(4). If that would be the case, meaning, that is what is affecting the 5 digit codes, what would be the method to establish a greater length, (say numeric(10)) in the resulting table????????
 
Rmiron,

Are these codes stored in strings or numerics?

Can you try doing the SELECT within MySQL? That will tell you whether it is VFP or MySQL that is at fault. (I don't know if MySQL has a console where you can enter commands, like SQL Server has.)

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thank you Mike!!!! I feel so stupid. I was using the wrong field. Thanks for your time and response, anyway.

Bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top