Solved

Add column to database table

Posted on 2009-07-09
3
289 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
Comment Utility
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
Comment Utility
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
Comment Utility
I did not realize that it was that simple, I was searching for a much more complicated solution LOL
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now