Link to home
Start Free TrialLog in
Avatar of Mr_Shaw
Mr_Shaw

asked on

Create a table and add a row.... is there anything wrong with the code?

           DataTable dtbl = ds.Tables[0];
           
            DataTable   schemaDataTable = new DataTable();
            DataColumn  schemaDataColumn;
            schemaDataColumn = new DataColumn();
            schemaDataColumn.DataType = Type.GetType("System.String");
            schemaDataColumn.ColumnName = "ColumnName";
            schemaDataTable.Columns.Add(schemaDataColumn);




            DataRow row = schemaDataTable.NewRow();

            row["ColumName"] = "Name";
            schemaDataTable.Rows.Add(row);
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Looks ok to me. Are you having a problem with it?
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@ tgerbert: Good looking.
Looked at it for 5 min and didn't see that.
I copied & pasted it into a console project, Visual Studio found it for me. ;)
Avatar of Mr_Shaw
Mr_Shaw

ASKER

thanks