Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exporting data in MSACCESS
Message
From
03/02/2007 17:47:31
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01192149
Message ID:
01192156
Views:
24
>Is there any way to put data into MS ACCESS tables without using ADO?
>
>Can we create MS ACCESS databases and tables using Visual FoxPro?

I've done that once, but I think I just created a blank mdb in Access, and then did everything else using SPT or remote views. I had to do some export, so I'd unzip this blank mdb each time, and it had this one table that I needed with zero records, and I'd just SqlExec() a series of insert statements.
Code went like this (scanning through my table to be exported):
#define c_lbracket "["
#define c_rbracket "]"
#Define CRLF Chr(13)+Chr(10)
#Define c_bufferlen 0x00010000
#Define C_SQUOTE [']

[snip - code to open tables, connect etc]

Scan
	cFieldlist=""
	cValueList=""
	cComma="("
	SCATTER MEMVAR memo
	For i=1 To Fcount(tcAlias)
		cField=Field(i,tcAlias)
		uValue=Evaluate("m."+cField)
		If Not Empty(uValue) And Not Isnull(uValue)
			cFieldlist = cFieldlist + cComma+c_tab+c_lbracket+cField+c_Rbracket
			cValueList = cValueList + cComma+c_tab+"?m."+cField
			cComma=","
		Endif
	Endfor
	If !Empty(cFieldlist)
		cFieldlist = cFieldlist + ")"
		cValueList = cValueList +  ")"
*-- TEXT BLOCK BEGIN
		TEXT TO cSql NOSHOW TEXTMERGE
	INSERT INTO export <<cFieldList>> values <<cValueList>>
		ENDTEXT
*-- TEXT BLOCK END
		nSt=SQLExec(h, cSql, "any")
		If nSt<0
			ERROR "bad export"
		Endif
	Endif
Endscan

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform