The following codes insert the Data inside the XML file using the ADD NEW USER Form. Now i want to display the confirmation message to the User's that the
Data has been Successfully added or Data not inserted message. Also i want to know how to add
TRY, CATCH and FINALLY method in this code. Pls edit my code and send me. ]
CODE:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
' Create a DataSet with one table and three columns.
Dim OriginalDataSet As New DataSet("myDataSet")
OriginalDataSet.Namespace = "NetFrameWork"
Dim myTable As New DataTable("myTable")
Dim c1 As New DataColumn("AccNumber", Type.GetType("System.Int32"))
'c1.AutoIncrement = True
Dim c2 As New DataColumn("Name", Type.GetType("System.String"))
Dim c3 As New DataColumn("Balance$", Type.GetType("System.Double"))
myTable.Columns.Add(c1)
myTable.Columns.Add(c2)
myTable.Columns.Add(c3)
OriginalDataSet.Tables.Add(myTable)
Dim newRow As DataRow
newRow = myTable.NewRow()
newRow("AccNumber") = txtAccNumber.Text.ToString()
newRow("Name") = txtName.Text.ToString()
newRow("Balance$") = txtBalance.Text.ToString()
myTable.Rows.Add(newRow)
OriginalDataSet.AcceptChanges()
' Write the schema and data to an XML file.
Dim xmlFilename As String = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Demo_aps\Demo_aps\myXmlDocument.xml"
' Use WriteXml to write the document.
OriginalDataSet.WriteXml(xmlFilename)
' Dispose of the original DataSet.
OriginalDataSet.Dispose()
End Sub
Utsavp
Member
22 Points
55 Posts
Showing confirmation message.
May 11, 2010 06:18 AM|LINK
Hi,
The following codes insert the Data inside the XML file using the ADD NEW USER Form. Now i want to display the confirmation message to the User's that the Data has been Successfully added or Data not inserted message. Also i want to know how to add TRY, CATCH and FINALLY method in this code. Pls edit my code and send me. ]
CODE:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click ' Create a DataSet with one table and three columns. Dim OriginalDataSet As New DataSet("myDataSet") OriginalDataSet.Namespace = "NetFrameWork" Dim myTable As New DataTable("myTable") Dim c1 As New DataColumn("AccNumber", Type.GetType("System.Int32")) 'c1.AutoIncrement = True Dim c2 As New DataColumn("Name", Type.GetType("System.String")) Dim c3 As New DataColumn("Balance$", Type.GetType("System.Double")) myTable.Columns.Add(c1) myTable.Columns.Add(c2) myTable.Columns.Add(c3) OriginalDataSet.Tables.Add(myTable) Dim newRow As DataRow newRow = myTable.NewRow() newRow("AccNumber") = txtAccNumber.Text.ToString() newRow("Name") = txtName.Text.ToString() newRow("Balance$") = txtBalance.Text.ToString() myTable.Rows.Add(newRow) OriginalDataSet.AcceptChanges() ' Write the schema and data to an XML file. Dim xmlFilename As String = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Demo_aps\Demo_aps\myXmlDocument.xml" ' Use WriteXml to write the document. OriginalDataSet.WriteXml(xmlFilename) ' Dispose of the original DataSet. OriginalDataSet.Dispose() End SubPlease it is Urgent