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
Solved

Add column to database table

Posted on 2009-07-09
3
313 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
  • 2
3 Comments
 
LVL 59

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 59

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal reports vb.net 2 54
Import Data from Multiple Text Files in Excel 12 58
Write to a printer using vb.net 9 39
vb.net winforms sizing/resolution? 4 42
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 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