Solved

Add column to database table

Posted on 2009-07-09
3
317 Views
Last Modified: 2012-05-07
I have an application that is going to import data from a tab delimited text file to a table in SQL Server 2005. Sometimes the column does not already exist in the database table. What do I have to write for code to go about adding a column to the database table in vb .net?
0
Comment
Question by:theomysh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24817284
You execute a SQL statement such as this for MS SQL Server for example:
(http://msdn.microsoft.com/en-us/library/aa275462(SQL.80).aspx)
ALTER TABLE your_table_name
ADD COLUMN column_name {datatype};

Open in new window

0
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 24817295
If different backend database, you would just construct an appropriate SQL statement and use something like ExecuteNonQuery() from a SqlCommand object.
0
 

Author Comment

by:theomysh
ID: 24818071
I did not realize that it was that simple, I was searching for a much more complicated solution LOL
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question