Click here to Skip to main content
15,882,794 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dynamically Create SQL Database Table with column using

1 solution

1) Connect to your database via an SqlConnection as usual
2) Construct a SqlCommand CREATE TABLE Command.
CREATE TABLE [dbo].[myTable](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [amount] [int] NOT NULL,
    [dat] [nchar](10) NULL,
    [amountOwed] [float] NOT NULL

3) Use the ExecuteNonQuery method.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900