Filling dataset with xmlschema?
Hello, let's suppose I have to insert a record into a table in my database, I need the table description (e.g. fields names, type of field relations...). The question is how to get this into a new dataset. I tried the code below unsuccessfully.
VB Code:
DataAdapter = DB.GetDataAdapter("SELECT * FROM mytable) ' This is a procedure in my
'class DB and it works, I posted it in another thread...
Dim DS As New DataSet()
DataAdapter.Fill(DS, "mytable")
dim xml as string=DS.GetXmlSchema
Dim ds As New DataSet()
Dim ms As New IO.MemoryStream()
Dim sw As New IO.StreamWriter(ms)
sw.Write(xml)
sw.Flush()
'position to the start of the stream
ms.Position = 0
'read the xml in to the dataset
ds.ReadXmlSchema(ms) ' Here's where I get error, saying... nothing!!!(General error)
'clean up
sw.Close()
ms.Close()
Any ideas?
Thanks a lot!