Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

c# 2005-.sql2005  Adding a table

Posted on 2007-10-11
2
Medium Priority
?
153 Views
Last Modified: 2010-03-19
in c# 2005 how can i dynamically add a column to an  SQL table.  please include info to set the column parameters
0
Comment
Question by:the_b1ackfox
2 Comments
 
LVL 9

Author Comment

by:the_b1ackfox
ID: 20060862
PS  please include whatever options to set the primary key
0
 
LVL 8

Accepted Solution

by:
sjturner2 earned 2000 total points
ID: 20061099
You need to execute an alter table sql statement:

ALTER TABLE <table_name>
ADD <column_name1> <datatype1> <constraint1>

to add a primary key

ALTER TABLE xx ADD primary key(<column>)

Again, execute the sql commands using ADO.NET SqlCommand.ExecuteNonQuery.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

578 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