Getting Nil value for column from mysql database

  1. 6 days ago

    i am facing very strange scenario,

    When i am fetching records from mysql database i am getting Nil value for the all columns whose datatype is 'int' and length is 1.

    i am using mysql as database. and wrote following code to retrieve data.

    sql = "select StoreCode from tblstorefile"
    dim data as RecordSet
    data=app.db.SQLSelect(sql)

    if data <> Nil then
    txtStoreCode.Text = data.Field("StoreCode").StringValue

    Where i am doing wrong.

  2. Julian S

    Nov 7 Pre-Release Testers, Xojo Pro UK

    Maybe read an integer value?

    txtStoreCode.Text = str(data.Field("StoreCode").IntegerValue)
  3. @Julian S Maybe read an integer value?

    txtStoreCode.Text = str(data.Field("StoreCode").IntegerValue)

    i tried it but not worked.

    if change the datatype to double from int then it works fine, but i can't do that as my database is already ready.

    so want to know where i am going wrong so that i can fix issue.

  4. Julian S

    Nov 7 Pre-Release Testers, Xojo Pro UK

    What version of xojo are you using?
    Is the StoreCode column defined as INT(1) ?

  5. @Julian S What version of xojo are you using?
    Is the StoreCode column defined as INT(1) ?

    yes StoreCode column is defined as INT(1).

    i am using xojo 2017 r2. if i upgrade it, will that help?

  6. Julian S

    Nov 7 Pre-Release Testers, Xojo Pro UK

    I just tried it on 2017r2 and it worked fine so its not a bug in an older version.

    Pop a break after data=app.db.SQLSelect(sql) and inspect the data variable in the variables viewer and see if there's data returned?

  7. Julian S

    Nov 7 Pre-Release Testers, Xojo Pro UK
    Edited 6 days ago

    What version of mysql are you using?
    What value are you trying to retrieve from the INT?

  8. @Julian S I just tried it on 2017r2 and it worked fine so its not a bug in an older version.

    Pop a break after data=app.db.SQLSelect(sql) and inspect the data variable in the variables viewer and see if there's data returned?

    hi Julian,
    Problem get solved after i upgrade to latest version(2019 r2) without doing any change in source code.
    Thanks.

or Sign Up to reply!