예제 #1
0
        static void Main(string[] args)
        {
            WorkWithData workWithData = new WorkWithMySql();

            workWithData.datasource = "localhost";
            workWithData.port       = "3306";
            workWithData.username   = "******";
            workWithData.password   = "******";

            //добавление в таблицу контактов Нового человека
            workWithData.CreateRecord(new FieldTable
            {
                name        = "Сидор",
                surname     = "Сидоров",
                middle_name = "Сидорович",
                birthday    = "15.04.1981",
                comments    = "Лифтер"
            });



            //добавление в таблицу contact_list новый вид контакта
            workWithData.CreateRecord(new FieldTable
            {
                fio_id  = 10,
                type_id = 1,
                value_  = "555666444"
            });
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            WorkWithData workWithData = new WorkWithMySql($"datasource=localhost;database=contacts_book;port=3306;username=root;password=123456;");

            DataTable dt = new DataTable();

            dt = workWithData.SearchRecord("");

            dataGridView1.DataSource = dt;
        }