I was wondering if you could provide an example of code for me using VB.NET for
ID: 3593045 • Letter: I
Question
I was wondering if you could provide an example of code for me using VB.NET for the following. I'm using visual studio 2012 to program my application.
Using items from a list box, populate a new MS Access database table with the saved operations from the list box.
Program a button to save the items from the listbox into the database table. Program a button to retrieve the items from the database and display them in the list box.
Finally, You are going to enhance the application by saving, retrieving the operations data from and to XML files
add the following buttons to the form
-create a button "Save XML"
-create a button "Retrieve from XML"
make sure that the XML file is local to the application or allow the user to navigate to the file
Explanation / Answer
Dim i, sno As Integer
Dim sname As String
Dim rw As DataRow
'Add a new row to the Student table.
rw = DataSet11.Tables(0).NewRow
sno = InputBox("Enter the Roll no of the Student:")
sname = InputBox("Enter the Name of the Student:")
rw.Item("SNo") = sno
rw.Item("SName") = sname
Try
DataSet11.Tables(0).Rows.Add(rw)
'Update the Student table in the testdb database.
i = OleDbDataAdapter1.Update(DataSet11)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Displays number of rows updated.
MessageBox.Show("no of rows updated=" & i)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.