Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I make new column programmatically in c# windows application.

C#
for (int i = 0; i < 10; i++)
        {
            dataGridView1.Columns.Add(string.Format("colmun{0}", i), string.Format("number {0}", i));
        }

I want to know how I can save these columns in database.

Thank in advance
Posted
Updated 18-Nov-12 9:45am
v2

You need to create the column in the database, or create a schema where you can store arbitrary values by storing a column name as well as the data.
 
Share this answer
 
Comments
aliprogrammer 18-Nov-12 15:43pm    
I don't want to create column in database. I want to create column in C#. How can I do that?
Christian Graus 18-Nov-12 15:45pm    
You can't store it in the database, unless the database has a place for you to put it. It's a horrible design, but you CAN write SQL that runs from C# to create a new column. You have the column in C#, so your question makes no sense at this point.
 
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