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)
Try
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)
'OriginalDataSet.Dispose()
' Dispose of the original DataSet.
'MessageBox.Show("Inserted Successfully")
'Me.Hide()
MsgBox("Success”)
Catch ex As Exception
MsgBox("Failure”)
Finally
OriginalDataSet.Dispose()
End Try
Vijaya
Marked as answer by Utsavp on May 11, 2010 10:01 AM
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)
Try
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)
'OriginalDataSet.Dispose()
' Dispose of the original DataSet.
'MessageBox.Show("Inserted Successfully")
'Me.Hide()
MsgBox("Data Inserted Successfully")
Catch ex As Exception
MsgBox("Field Missing: Unable to Insert Data.")
Finally
OriginalDataSet.Dispose()
End Try
End Sub
Thank u very much. My code looks like this after error is free
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)
Try
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)
'OriginalDataSet.Dispose()
' Dispose of the original DataSet.
'MessageBox.Show("Inserted Successfully")
'Me.Hide()
MsgBox("Data Inserted Successfully")
Catch ex As Exception
MsgBox("Field Missing: Unable to Insert Data.")
Finally
OriginalDataSet.Dispose()
End Try
End Sub
Vijaya.A
Contributor
2408 Points
629 Posts
Re: Showing confirmation message.
May 11, 2010 08:59 AM|LINK
Hi r u using windows application or web application
if ur using windows application use msgbox-- for displaying msg success
if ur using web application import System.Web.UI
Utsavp
Member
22 Points
55 Posts
Re: Showing confirmation message.
May 11, 2010 09:16 AM|LINK
I am just using windows application.
Now how to use the MsgBox in such a Situation... Please reply..
Vijaya.A
Contributor
2408 Points
629 Posts
Re: Showing confirmation message.
May 11, 2010 09:21 AM|LINK
Hi use this code
MsgBox("Your Message") instead of page.register.........
Utsavp
Member
22 Points
55 Posts
Re: Showing confirmation message.
May 11, 2010 09:28 AM|LINK
can u send me a code. Please give me a complete answer.
Vijaya.A
Contributor
2408 Points
629 Posts
Re: Showing confirmation message.
May 11, 2010 09:31 AM|LINK
Hi I just modified ur above 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) Try 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) 'OriginalDataSet.Dispose() ' Dispose of the original DataSet. 'MessageBox.Show("Inserted Successfully") 'Me.Hide() MsgBox("Success”) Catch ex As Exception MsgBox("Failure”) Finally OriginalDataSet.Dispose() End Tryraj_june27
Member
117 Points
92 Posts
Re: Showing confirmation message.
May 11, 2010 09:36 AM|LINK
follow the code by vijaya mam..its perfect
Thanx & Regards
Raj.
Mark as ANSWER if it helps ...
Utsavp
Member
22 Points
55 Posts
Re: Showing confirmation message.
May 11, 2010 09:40 AM|LINK
Ok thank u very Much. At last My Code looks like:
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) Try 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) 'OriginalDataSet.Dispose() ' Dispose of the original DataSet. 'MessageBox.Show("Inserted Successfully") 'Me.Hide() MsgBox("Data Inserted Successfully") Catch ex As Exception MsgBox("Field Missing: Unable to Insert Data.") Finally OriginalDataSet.Dispose() End Try End SubUtsavp
Member
22 Points
55 Posts
Re: Showing confirmation message.
May 11, 2010 09:52 AM|LINK
Thank u very much. My code looks like this after error is free
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) Try 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) 'OriginalDataSet.Dispose() ' Dispose of the original DataSet. 'MessageBox.Show("Inserted Successfully") 'Me.Hide() MsgBox("Data Inserted Successfully") Catch ex As Exception MsgBox("Field Missing: Unable to Insert Data.") Finally OriginalDataSet.Dispose() End Try End Sub