Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8758311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:30:51+00:00 2026-06-13T14:30:51+00:00

Using VB 2010 and SQL Server 2008: I am able to insert new rows,

  • 0

Using VB 2010 and SQL Server 2008:

I am able to insert new rows, delete rows, and update data in a datatable, and use a data adapter to update the database without any issues. When I try to add new columns, the column appears in the data table, but it does not update to the database. I currently am using the DataAdapter.Update(DataTable) Method.

My code is as follows:

Dim dcNewColumn As New DataColumn
dcNewColumn.ColumnName = strClassColumnName
m_DataTable.Columns.Add(dcNewColumn)
m_DataTable.Row(intCurrentRow).Item(strClassColumnName) = strClassName
dcNewColumn = Nothing

m_DA.Update(m_DataTable)

Is there a different method to updating the database when inserting new columns?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:30:52+00:00Added an answer on June 13, 2026 at 2:30 pm

    You are looking for the ALTER TABLE sql command.
    Or the SQLDMO Columns Collection (Please check the notice at the start of the page)

    An ALTER TABLE Command to add a column could be coded in this way

    Dim cn As SqlConnection
    Dim cmd As SqlCommand
    Using cn = GetConnection()
        cn.Open()
        Using cmd = new SqlCommand()
             cmd.Connection = cn
             cmd.CommandText = "ALTER TABLE myTable ADD aNewColumn VARCHAR(20) NULL"
             cmd.CommandType = CommandType.Text
             cmd.ExecuteNonQuery()
        End Using
    End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Excel 2010 and SQL Server 2008 R2. I used import and export data
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; What I'm ultimately trying to do is update a sql
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; Kinda new at C# here.. I got the first row
I'm new to using SQL Server 2008 DB Project's in VS 2010. I found
I'm using VS 2010, MS SQL Server 2008, WPF 4 PalQuotationDataContext _palQuotationDataContext = new
I have created SQL Server 2008 Database project using visual studio 2010. after build
Using: Microsoft SQL Server 2008 Microsoft Visual Studio 2010 C# .NET 4.0 WinForms Ok
Using SQL, SQL server manager 2008, c-sharp.net 4.0 and ms visual studio professional 2010:
Using Visual Studio 2010 SP1, SQL server 2008: Motherboard recently failed and I migrated
I'm using Visual Web Developer 2010 Express and SQL Server 2008 R2 Management Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.