I am relatively new to SQL and this is my first time trying to use it in C# and can't understand why this isn't working, I know the Column I am trying to copy across does have values in it but when I try and display the 'test' DataTable in a DataGridViewer there are no rows at all
The data is from a database on a server and displays fine when setting the DataGridViewer.DataSource to thisDataSet.USERS
This is my code:
DataTable test = new DataTable();
test.Columns.Add("UserID");
SqlCommand command = new SqlCommand();
command.CommandText = "INSERT INTO test (UserID) SELECT USER_ID FROM thisDataSet.USERS";
command.ExecuteNonQuery();
dgvDataViewer.DataSource = test;