Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public firmCustomerTable()
- {
- InitializeComponent();
- MySqlConnection connection;
- config conf = new config();
- connection = new MySqlConnection(conf.connection_string);
- DataTable schema = null;
- using (var con = new MySqlConnection(conf.connection_string))
- {
- using (var schemaCommand = new MySqlCommand("SELECT * FROM firmenkunden", con))
- {
- con.Open();
- using (var reader = schemaCommand.ExecuteReader(CommandBehavior.SchemaOnly))
- {
- schema = reader.GetSchemaTable();
- }
- }
- }
- foreach (DataRow col in schema.Rows)
- {
- System.Windows.Controls.TextBox newTxt = new TextBox();
- System.Windows.Controls.CheckBox onoff = new CheckBox();
- // Add Label
- newTxt.Text = col.Field<String>("ColumnName");
- newTxt.Name = col.Field<String>("ColumnName");
- newTxt.Width = 200;
- // Add OnOff
- onoff.HorizontalAlignment = HorizontalAlignment.Center;
- onoff.Style = (Style)FindResource("CheckBoxStyle1");
- onoff.VerticalAlignment = VerticalAlignment.Center;
- // Add To Panel
- sp.Children.Add(newTxt);
- sp.Children.Add(onoff);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement