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 //欄位SNo 資料 rw.Item("SName") = sname //欄位SName 資料 Try DataSet11.Tables(0).Rows.Add(rw) //新增資料 'Update the Student table in the testdb database. i = OleDbDataAdapter1.Update(DataSet11) //新增到Access 收工 Catch ex As Exception MessageBox.Show(ex.Message) End Try 'Displays number of rows updated. MessageBox.Show("no of rows updated=" & i)