I did a search and found some seemingly related answers, but they don't really do what I'm after.
Given a valid connection string and a table name, I want to get a
dt["Name"] = "blah"
TOP 0 * from the table
You can use
var connection = @"Your connection string"; var command = "SELECT * FROM Table1"; var dataAdapter = new System.Data.SqlClient.SqlDataAdapter(command, connection); var dataTable = new DataTable(); dataAdapter.FillSchema(dataTable, SchemaType.Mapped);
This way you will have an empty
DataTable with columns and keys defined and ready to use in code like
dataTable["Name"] = "blah";.