Example #1
0
        private string createInsert(string keyOrvalue)
        {
            string request = " (";

            for (int index = 0; index < map.Count; index++)
            {
                var     item = map.ElementAt(index);
                Control itemValue;
                if (keyOrvalue == "key")
                {
                    itemValue = item.Key;
                }
                else
                {
                    itemValue = item.Value;
                }

                if (itemValue.Text != "" && item.Value.Text != "")
                {
                    if (index != 0)
                    {
                        request += ",";
                    }

                    request += keyOrvalue == "value"?DB.getByType(itemValue.Text).Substring(3): itemValue.Text;
                }
                else
                {
                    continue;
                }
            }
            request += ") ";
            return(request);
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string request = " WHERE ";

            foreach (Control item in listOfControls)
            {
                if (item is TextBox)
                {
                    request += DB.getByType(item.Text).Substring(3) + " ";
                }
                else
                {
                    if (item.Text == "")
                    {
                        MessageBox.Show("Fill in all the fields!");
                        return;
                    }
                    request += item.Text + " ";
                }
            }
            controller.loadTable(table, request);
        }