Hi, I have a script which executes perfectly with not errors, however it simply does not work!
As I said before, there are no errors, it simply doesnt work, the database remains unchanged.
One thing interesting to note, is that when setup recounts the columns, it includes the new column in its count, yet for all I can see it isnt in the database, and then my program crashes trying to access the item at the last count.
Any ideas?
Thanks,
Tom
Code:
Dim cb As New OleDb.OleDbCommandBuilder(TableForm.da)
Dim thenewcol As New System.Data.DataColumn
thenewcol.ColumnName = nameofcol.Text
TableForm.ds.Tables("PeriodicDB").Columns.Add(thenewcol)
TableForm.da.Update(TableForm.ds, "PeriodicDB")
TableForm.setup()
Code:
Public Sub setup()
ds.Clear()
con.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0; DATA Source = " + path
Try
con.Open()
Catch ex As Exception
lblStatus.Text = "Error!"
lblLink.Text = "Details..."
exceptionText = ex.ToString()
Return
End Try
sql = "SELECT * FROM PeriodicElements"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "PeriodicDB")
sql = "SELECT * FROM data_inc"
da2 = New OleDb.OleDbDataAdapter(sql, con)
da2.Fill(ds, "ColNames")
tot_columns = ds.Tables("PeriodicDB").Columns.Count
lblStatus.Text = ("Connection to DB was successful.")
lblLink.Text = ""
con.Close()
End Sub
As I said before, there are no errors, it simply doesnt work, the database remains unchanged.
One thing interesting to note, is that when setup recounts the columns, it includes the new column in its count, yet for all I can see it isnt in the database, and then my program crashes trying to access the item at the last count.
Any ideas?
Thanks,
Tom