I have a database with no datatable. I add a datatable (temp1) and 3 columns (column1, column2 and column3) to that datatable (by setting the CommandText property of a Command object called m_cmd and then invoking the ExecuteNonQuery method.) (Also, m_conn is the connection that m_cmd uses to talk to the database.)
I then add the same datatable & columns to the corresponding typed dataset (m_ds) which I created at design time using the Devart Dataset Wizard. These are both done at runtime programatically by clicking the button called m_createTableButton.
I exit my application and re-start it. The database retains those changes (the new datatable & its new columns are still there), but the dataset does not. It's still in the original form, as if I'd never made those changes.
How do I save those dataset changes before exiting the app? Does it have something to do with the WriteXmlSchema method of the m_ds dataset?
-------REFERENCE CODE
Private Sub m_createTableButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_createTableButton.Click
'Create a new table & 3 columns in the dataBASE
m_cmd.CommandText = "CREATE TABLE temp1 (column1 character varying(10), column2 character varying(10), column3 character varying(10))"
m_conn.Open()
m_cmd.ExecuteNonQuery()
m_conn.Close()
'Now create the same table & 3 columns in the dataSET
Dim temp1 As DataTable = New DataTable("temp1")
temp1.Columns.Add("column1", GetType(System.Char))
temp1.Columns.Add("column2", GetType(System.Char))
temp1.Columns.Add("column3", GetType(System.Char))
m_ds.Tables.AddRange(New DataTable() {temp1})
End Sub
How2 save changes to dataSET made at runtime?
The method WriteXmlSchema() writes untyped DataSet to a file.
If you want to save chages you made in runtime to the typed DataSet, you should act in the way similar to the one described in the post
http://www.devart.com/forums/viewtopic.php?t=13322 ,
but we cannot guarantee the workability of this solution, because we do not support it officially.
If you want to save chages you made in runtime to the typed DataSet, you should act in the way similar to the one described in the post
http://www.devart.com/forums/viewtopic.php?t=13322 ,
but we cannot guarantee the workability of this solution, because we do not support it officially.