Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai Friends,


I got problem in my project .

I need to create a table in my database through front end dynamically but column names should be static for all the tables and i need to create the tables with static column fields which have created dynamically by user
Posted

1 solution

You can create the table for example by executing CREATE TABLE[^] command using SqlCommand[^].

for example
C#
...
string sql = @"
CREATE TABLE SomeTable (
   Column1 int
)";
command.CommandText = sql;
command.ExecuteNonQuery();
...

You would first need to create the connection and command and build the proper SQL statement in your code.
 
Share this answer
 
Comments
Nilesh Patil Kolhapur 26-May-12 3:31am    
nice answer
Wendelius 26-May-12 3:42am    
Thanks :)
Monjurul Habib 26-May-12 15:49pm    
5!
Wendelius 1-Jun-12 0:31am    
Thanks :)

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