- string connString = "Data Source=192.168.0.2;Initial Catalog=test;Integrated Security=True";
- SqlConnection conn = new SqlConnection();
- conn.ConnectionString = connString;
- conn.Open();
- DataTable dt = new DataTable();
- dt = conn.GetSchema("Tables");
- foreach (DataColumn column in dt.Columns)
- {
- tab_A.Columns.Add(column.Caption);
- }
- conn.Close();
- }