Creating on-the-fly-table
Charles Cohen
rwc1717 at shaw.ca
Mon May 16 06:39:32 CDT 2005
I have an exisiting database and I want to add a temporary table
After creating a new temporary table for my database MyADB (already
opened with two tables on disk of its own.) The purpose is to copy
selected records to this temporary table and then dump it an xml file
and then drop the table.leaving the original database intact.
I coded it as follows
dim v as VTable
dim vf as VField
dim s() as String
dim rsxml as VCursor
v = new MyADB.CreateTable("xmlTmp",EVTableKind.kTblTemporary)
vf = v.CreateStringField("DescriptA", 100)
vf = v.CreateStringField("HighA",15)
vf = v.CreateStringField("LowA",15)
vf = v.CreateStringField("TargA",15)
vf = v.CreateStringField("DivdA",15)
vf = v.CreateStringField("PerfA",20)
vf = v.CreateStringField("equityIDA",25,EVFlag.fIndexed)
vf = v.CreateStringField("BuyA",15)
for i = 0 to ArchLB.Listcount-1
if ArchLB.cellcheck(i,1) then
rs = Nil
rs = aDb.SQLSelect("select * from aEquity where equityIDA =
'"+archLB.cell(i,2)+"'",EVCursorLocation.kClientSide)
s.append rs.Field("DescriptA").GetString()
s.append rs.Field("HighA").GetString()
s.append rs.Field("LowA").GetString()
s.append rs.Field("TargA").GetString()
s.append rs.Field("DivdA").GetString()
s.append rs.Field("BuyA").GetString()
s.append rs.Field("PerfA").GetString()
s.append rs.Field("equityIDA").GetString()
v.SetBlank()
v.StringField("DescriptA").SetString(s(0))
v.StringField("DescriptA").Value = s(0)
v.StringField("HighA").Value = s(1)
v.StringField("LowA").Value = s(2)
v.StringField("TargA").Value = s(3)
v.StringField("DivdA").Value = s(4)
v.StringField("BuyA").Value = s(5)
v.StringField("PerfA").Value = s(6)
v.StringField("equityIDA").Value = s(7)
call v.Addrecord()
//rsxml = aDB.SqlSelect("Select * from xmlTmp WHERE
false",EVCursorLocation.kServerSide, EVLockType.kReadWrite)
//rsxml.StringField("DescriptA").Value = s(0)
//rsxml.StringField("HighA").Value = s(1)
//rsxml.StringField("LowA").Value = s(2)
//rsxml.StringField("TargA").Value = s(3)
//rsxml.StringField("DivdA").Value = s(4)
//rsxml.StringField("BuyA").Value = s(5)
//rsxml.StringField("PerfA").Value = s(6)
//rsxml.StringField("equityIDA").Value = s(7)
//call rsxml.Addrecord()
v.flush
redim s(7)
rs = Nil
end if
next
fiXML = GetFolderItem("charts.xml")
indumpformat = true
v.Dump( fiXML, 2, 2,indumpformat)
MyADB.DropTable("xmlTmp")
msgbox "XML File"
I retreive the record but I get NilObjectEception for any of attempts
at writing the data to the new table whether trying to use a cursor or
trying to use a table, as well as, the MyADB doesn't drop it when I
ask.
My first attempt at creating the xml file, I tried to remove the
records I didn't want from the already existing tables...dumping the
balance to the xml file but not flushing....
The records got deleted anyways?
What is my problem?
Rik, Harry, Wendy, & Chuck
More information about the Valentina
mailing list