コード例 #1
0
        private void insertD_Click(object sender, EventArgs e)
        {
            int           i = 0;
            List <Type>   columns = new List <Type>();
            string        tableName, requete;
            SqlCommand    command;
            SqlConnection cnn;
            SqlDataReader reader;
            DataSet       ds;

            tableName    = tables.SelectedItem.ToString();
            CurrentTable = new TableInformation(tableName);
            requete      = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = " + "'" + tableName + "'" + ";";
            cnn          = new SqlConnection(this.chaine_connection);
            cnn.Open();
            command = new SqlCommand(requete, cnn);
            reader  = command.ExecuteReader();
            while (reader.Read())
            {
                CurrentTable.AddType(reader.GetFieldType(i));
                CurrentTable.AddColumnName(reader.GetString(i));
            }

            Form2 formInsert = new Form2(CurrentTable);

            formInsert.ShowDialog();
        }
コード例 #2
0
 public Form2(TableInformation CurrentTable)
 {
     this.CurrentTable = CurrentTable;
     InitializeComponent();
     this.CreateFields();
     this.SubmitButton();
     for (int i = 0; i < columns_field.Count; i++)
     {
         MessageBox.Show(columns_field[i].Text);
     }
 }