Jump to content
The simFlight Network Forums

Inserting position data into mysql database

Recommended Posts

Hi everyone,

I'm working on a little program which will insert aircraft's current latitude and longtitude to a mysql database. I am using visual basic 6. In VB I get the position data from FSUIPC as DOUBLE data type. But when I try to insert these data to the database I get a type missmatch error. The data types in mysql are DOUBLE as well. I also tried decimal and float in mysql but I got the same error message. What's the problem here? If anyone knows the answer I'd appreciate your help


I get the position from FSUIPC using these codes:

Dim latitude as Double

Dim longtitude as Double

Dim FakeLat As Currency

Dim FakeLon As Currency

Dim dwResult As Long

Call FSUIPC_Read(&H560, 8, VarPtr(FakeLat), dwResult)

Call FSUIPC_Read(&H568, 8, VarPtr(FakeLon), dwResult)

Call FSUIPC_Process(dwResult)

latitude = FakeLat * 10000#

latitude = latitude * 90# / (10001750# * 65536# * 65536#)

longtitude = FakeLon * 10000#

longtitude = longtitude * 360# / (65536# * 65536# * 65536# * 65536#)

Thank you

Link to comment
Share on other sites

Ok I solved the problem.I tried to insert the value to the database using this sql:

rs.open "insert into table(latitude,longtitude) values (" + latitude + "," + longtitude + ")",connection, adOpenStatic, adLockOptimistic

I guess the problem was about the "+" symbols I used in the sql. I changed them with the "&" symbol and the problem is solved. Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.