I need to add an additional column after SQLDataAdapater filled it out.

Socarsky

Well-known member
Joined
Mar 3, 2014
Messages
59
Programming Experience
Beginner
I want to do that without "Computed Column" in SQL, because it's a column, which contain image and text depends a condition whether true or false.
I got below, I cannot achieve to add a column with the filled rows' starter or end of it.
jkjkjk.png
 

Socarsky

Well-known member
Joined
Mar 3, 2014
Messages
59
Programming Experience
Beginner
Maybe because you are creating new rows? (t.NewRow)
Thanks for pointing my wrong approach where was that. Now I've resolved my issue thanks to you.
DataTable t = new DataTable();
                    a.Fill(t);

                    DataColumn newCol = new DataColumn("NewColumn", typeof(string));
                    newCol.AllowDBNull = true;
                    t.Columns.Add(newCol);
                    foreach (DataRow row in t.Rows)
                    {
                        row["NewColumn"] = "With String";
                    }
                    dataGridView1.DataSource = t;


resolved.png
 
Top Bottom