Question : Access Database

I use an access database to create an .xml inventory list.  There are three columns in the tables that need to enclose the information in [cdata[  ]] so that when my flash program reads it, the text is rendered correctly.  Is there an easy way to make that happen from the database or do I have to include the  [cdata[  ]] in the text when it is corrected?

Answer : Access Database

Generally, you build out the text export as needed, then "write" it to your XML file. You don't generally include the tags/delimiters in the actual data.
 
For example, if I have a table named Table1, and I want to export the values in a field named "sName" to a textfile named "TESTFILE.txt" in the currrent database directory, the attached code will do that. You would of course have to modify this to be formatted to your needs.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Function TestFile()

Dim rst As DAO.Recordset
Dim lFile As Long
Dim sFile As String

lFile = FreeFile
Open CurrentProject.Path & "\TESTFILE.txt" For Output As #lFile

Set rst = CurrentDb.OpenRecordset("SELECT sName FROM TAble1")


Do Until rst.EOF
  sFile = sFile & rst("sName") & ";"
  rst.MoveNext
Loop

sFile = "[CDATA[" & sFile & "]]"

Print #lFile, sFile

Close #lFile


End Function
Random Solutions  
 
programming4us programming4us