Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WARLOCK's ADODB STREAM ADOX persisted in XML

Status
Not open for further replies.

WARLOCK

Programmer
Aug 14, 2001
4
US


I am so sorry to bother you with this triviality


Sorry To bother you


I keep posting my questions in various forums & receiving no response.

So if you would be so kind
I wonderfully created a new MS Access database in VB6 utilizing ADOX's catalog object.

I am working with an existing database lets say Northwind and lets pick a small table shippers.

I persisted this table as an xml file & modifed it slightly in a form. I then write this xml with modifications back out to another xml file.

( I should really re-examine how I pull this off readtext write text or what have you)

With my new database on disk (& its existance is confirmed) I desire to utilize the ADODB stream to "automate" filling in or creating the tables in this new database. With the modified data from Northwind's Shippers table.

Visual Studio Mag.'s new 101 Tech Tips Sept 2001 Vol 11 No 10 First in the new name versus the old VB Programmers journal. Top of page 18 hints at my answer but leaves open my question to you. It demonstrates how to create a duplicate recordset with the stream object ( which I can do) But to save it ( to my newly created database from ADOX) I need to create a new connection object to it. Sounds easy enough but how can I Stream.open with no existing tables to pass this data to. Must I create a table first. Basically after creating a coonnection to the new database, how do I get its empty recordset ( if I need to create on in ADOX) to open.stream my modified data. Or is the table even necessaary beforehand??
After all of this does the stream.open require writetext to actually fill in data to the destination table.



Im sorry to bother you with this.

But I have like 8 windows open looking for forums to maybe give me an answer.

heres some laughable code. Please help with this... !

Public Function RSfrmXML(sXML As String) As Recordset


Dim ostream As New ADODB.Stream
Dim NewRS As New ADODB.Recordset
Dim sPro As String
sPro = "Microsoft.Jet.OLEDB.3.51"

Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim strDatabase As String
Dim strTable As String


'snew as new database name & Path
'Sfile as Saved persisted XML data corrected in Form


conn.CursorLocation = adUseClient
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & snew
conn.Open

ostream.Open
'rs.Open sFile
'rs.Save ostream, adPersistXML
'NewRS.ActiveConnection = conn
'NewRS.Open "Provider=" & sPro & "; Data Source=" & snew


ostream.LoadFromFile (sFile)
ostream.Position = 0
NewRS.Open ostream
NewRS.UpdateBatch
ostream.Close
Set ostream = Nothing

Set RSfrmXML = NewRS

Set frmADOxml.dc1.Recordset = NewRS
'NewRS = Nothing
MsgBox "Whoo Hoo" & "Any Data in the damn Thing Yet?", vbOKOnly, "WARLOCK"

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top