I am using the following code to add a row to an exisitng databse and now I am trying to add a column, the code executes ok with no error messages and the column is being added to the datatable, but it does not appear to be added to the database can anyone see what I am doing wrong?
HTML Code:Dim da As New OleDbDataAdapter("Select * From " & Me.OpenFileDialog1.SafeFileName & "", con) Dim cb As New OleDb.OleDbCommandBuilder(da) Dim dsNewRow As DataRow Dim dsNewCol As DataColumn = New DataColumn("Condition", System.Type.GetType("System.String")) ds.Tables("dataset").Columns.Add(dsNewCol) dsNewRow = ds.Tables("dataset").NewRow() dsNewRow.Item("Condition") = Me.subj_cond_txt.SelectedIndex If Me.subjectaddtxt.Text <> "" Then dsNewRow.Item("AddressDisplay") = Me.subjectaddtxt.Text End If If Me.subj_mls_txt.Text <> "" Then dsNewRow.Item("MLSNUM") = Me.subj_mls_txt.Text End If If Me.subj_orglp_txt.Text <> "" Then dsNewRow.Item("ListPriceOrig") = CInt(Me.subj_orglp_txt.Text) End If dsNewRow.Item("Beds") = Me.subj_bed_txt.Text dsNewRow.Item("BathsTotal") = Me.subj_ba_txt.Text If Me.subj_dom_txt.Text <> "" Then dsNewRow.Item("DaysOnMarket") = Me.subj_dom_txt.Text End If dsNewRow.Item("FirePlace") = Me.subj_fp_txt.Text dsNewRow.Item("NumGarages") = Me.subj_gar_txt.SelectedIndex dsNewRow.Item("SqFtTotal") = Convert.ToInt32(Me.subj_gla_txt.Text) dsNewRow.Item("PropertyAttached") = Me.subj_housetype_txt.Text dsNewRow.Item("ListDate") = Me.DateTimePicker1.Value If Me.subj_lotsize_txt.Text <> "" Then dsNewRow.Item("LotSize") = CInt(Me.subj_lotsize_txt.Text) End If If Me.subj_lp_txt.Text <> "" Then dsNewRow.Item("ListPrice") = CInt(Me.subj_lp_txt.Text) End If dsNewRow.Item("PoolDesc") = Me.subj_pool_txt.SelectedIndex dsNewRow.Item("SpecialConditions") = Me.subj_housetype_txt.SelectedIndex dsNewRow.Item("Stories") = Me.subj_levels_txt.Text dsNewRow.Item("ViewDesc") = Me.subj_view_txt.SelectedIndex If Me.subj_yb_txt.Text <> "" Then dsNewRow.Item("YearBuilt") = Me.subj_yb_txt.Text End If dsNewRow.Item("Style") = Me.subj_style_txt.SelectedIndex If Me.subj_hoaduestxt.Text <> "" Then dsNewRow.Item("AssocFee") = Me.subj_hoaduestxt.Text End If dsNewRow.Item("ListStatus") = Me.subj_status_txt.SelectedIndex ds.Tables("dataset").Rows.Add(dsNewRow) da.Update(ds, "dataset") MsgBox("New Record added to the Database")




Reply With Quote