Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, I have a script which executes perfectly with not errors, however it simply does not work!

 

 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()

 

  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 doesn't 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 isn't in the database, and then my program crashes trying to access the item at the last count.

 

Any ideas?

 

 

Thanks,

 

Tom

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...