Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 
Returns a DataTypeEnum value that indicates the type of a Field object in the form of a string

 

Syntax

 

s = <ADODB_Recordset>.Fields(Name | lIndex).Type$

 

Returns

 

String: one of the DataTypeEnum value in the form of a string

 

Parameters

 

Single Field inside a Fields Collection can be reached indicating Field Number (from 1 to <ADODB_Recordset>.Fields.Count) or indicating Field Name (the name of the column in the RecordSet)

 

Name

Type

Optional

Meaning

Name

String


Field Name (the name of the column in the RecordSet)

lIndex

Numeric


Field Number (from 1 to <ADODB_Recordset>.Fields.Count)

 

 

Remarks

 

This property is not a standard ADODB command

 

Restrictions

 

See also

 

Examples

 

Uses "Console"

Uses "ADODB"

 

'---Declare a new pConnection variable and instantiate it in one line

Dim pConn As New ADODB_CONNECTION

 

printl "-----------------------------------------"

printl " Connection info"

printl "-----------------------------------------"

'---Set the provider and open a DB

pConn.Provider = "Microsoft.Jet.OLEDB.4.0"

pConn.Open(APP_SourcePath & "Biblio.mdb")

 

'---Print some info

PrintL pConn.Provider

Printl pConn.ConnectionString

 

'---If connection is open then Executes a command and print some data

If pConn.State = %ADSTATEOPEN Then

 

  Dim pRS     As New ADODB_RECORDSET

  Dim sSql    As String

  dim nRec    as Long

  dim nField  as Long

 

  PrintL

  printl "-----------------------------------------"

  printl " SQL Query info"

  printl "-----------------------------------------"

  sSql = "Select * from Authors order by Au_ID"' Where Au_ID = 1"

  PrintL "Query is:", sSql

 

  '---Connection Execute 

  pRS = pConn.Execute(sSql)

 

  printl

  printl "-----------------------------------------"

  printl " Recordset state:", pRS.State

  printl "-----------------------------------------"  

 

  if pRS.State = %adStateOpen Then

 

    printl

    printl "-----------------------------------------"

    printl " List Recordset fields info"

    printl "-----------------------------------------"

    printl "Number of fields:", pRS.Fields.Count

 

    for nField = 1 to pRS.Fields.Count

      printl "Field Name", nField & ":", pRS.Fields(nField).Name

      printl $TAB"Type:", pRS.Fields(nField).Type & " (" & , pRS.Fields(nField).Type$ & ")"

      printl $TAB"DefinedSize:", pRS.Fields(nField).Definedsize

      printl $tab"ActualSize:", pRS.Fields(nField).Actualsize

    Next

    

    printl

    printl "-----------------------------------------"

    printl " List some data"

    printl "-----------------------------------------"

    

    nRec = 0

    While not pRS.EOF and nRec <= 9

      'printl pRS.Collect("Au_ID"), pRS.Collect("Author"), , pRS.Collect("Year Born")

      printl pRS.Fields("Au_ID").Value, pRS.Fields("Author").Value, , pRS.Fields("Year Born").Value

      incr nRec

      pRS.MoveNext

    Wend

  

    pRS.Close

  end If

  

  pConn.Close

 

end If

 

WaitKey

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software