Results 1 to 8 of 8

Thread: determine data type

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philippines
    Posts
    49

    Question

    how can i determine the datatype of the field im accessing, im using the rs.fields = <string>. What if the data type of the field is not string, i need to know so i can convert my <string>


  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    you need to query the Rs.Fields("FieldName").Type, this will return for example:

    adVarBinary A binary value (Parameter object only).
    adVarChar A String value (Parameter object only).
    adVariant An Automation Variant (DBTYPE_VARIANT).


    I'm assuming you're using ADO
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philippines
    Posts
    49

    Question Determine data type question follow up -- DAO

    im using DAO

  4. #4
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Just tried it in DAO 3.6, works fine , so you should be ok
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  5. #5
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    hm

    declare ls_value as variant

    if VarType(ls_Value) = vbDate then
    '
    else if vartype(ls_value) = vbString

    etc...

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philippines
    Posts
    49

    Thumbs up

    thanks guys

  7. #7

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philippines
    Posts
    49

    Question

    you need to query the Rs.Fields("FieldName").Type, this will return for
    example:

    adVarBinary A binary value (Parameter object only).
    adVarChar A String value (Parameter object only).
    adVariant An Automation Variant (DBTYPE_VARIANT).

    ---

    are there adVarInteger and adVarDate?


  8. #8
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Heres the complete list for DAO:

    dbBigInt Big Integer
    dbBinary Binary
    dbBoolean Boolean
    dbByte Byte
    dbChar Char
    dbCurrency Currency
    dbDate Date/Time
    dbDecimal Decimal
    dbDouble Double
    dbFloat Float
    dbGUID GUID
    dbInteger Integer
    dbLong Long
    dbLongBinary Long Binary (OLE Object)
    dbMemo Memo
    dbNumeric Numeric
    dbSingle Single
    dbText Text
    dbTime Time
    dbTimeStamp Time Stamp
    dbVarBinary VarBinary

    HTH
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width