WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Access

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Dealing with ACCESS 97 Field Types

 Keywords:  

Sample Code:

; //////////////////////////////////////////////////////////////
; OLE DB Script that Reads ACCESS 97 Field Types and Values
; Stan Littlefield 02/01/2001
; //////////////////////////////////////////////////////////////

MDB="wbtest.mdb"
tablename="Test"
cConn  = "Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%MDB%;"
DB     = ObjectOpen("ADODB.Connection")
DB.Open(cConn)
;select everything from the table
RS     = DB.Execute("SELECT * FROM %tablename%")
flds   = RS.Fields
;Count the fields
nCnt   = flds.Count()

For i=0 To nCnt-1
   ;extract the field
   fld = RS.Fields(i)
   n   = fld.Name
   t   = fld.Type
	; handle for Ole object type
	; winbatch cannot retrieve that value
   If t<>205
      v   = fld.Value
      message("Field %i% %n%",%t%)
      message("Value","%v%")
   Else
      message("Field %i% %n%",strcat(%t%," is an Object Type"))
   Endif
Next

DB.Close()
ObjectClose(DB)
exit



Article ID:   W14688
Filename:   Dealing with ACCESS 97 Field Types.txt
File Created: 2001:02:07:13:13:08
Last Updated: 2001:02:07:13:13:08