如果日期存在更新或插入Sql C#

时间:2017-05-31 21:13:39

标签: c# mysql

这是我的数据库设计

ID日期数据_1数据_1数据_2数据_2

我想用combobox select添加新数据。我正在使用

// Match side a
MATCH (n1:Person)--(m:Person)
WITH n1, COLLECT(m) as friends
// Match side b
MATCH (n2:Person)--(m:Person)
WITH n1, n2, friends as friends1, COLLECT(m) as friends2
// Filter out a-b same node or non identical friends lists.
WHERE n1<>n2 AND SIZE(friends1) = SIZE (friends2) AND ALL (f in friends1 WHERE f in friends2)
RETURN n1, n2

如果日期存在,我想控制日期,必须更新数据。 示例数据库是

         if (comboBox2.SelectedIndex == 0)
            {
                datacolumn = "Data_1";
                datacountcolumn = "Data_1a";
            }
            if (comboBox2.SelectedIndex == 1)
            {
                datacolumn = "Data_2";
                datacountcolumn = "Data_2a";
            }
cmd.CommandText = "insert into Info (Date ,"+datacolumn+","+ datacountcolumn +") values ('" + date.ToString("dd.MM.yyyy") + "','" + textBox3.Text + "','" + datacount.ToString() + "')";

我希望在3.5.2017时使用Data_2和Data_2a添加新数据 新表必须

 - Id              1 
 - Date            3.5.2017 
 - Data_1          Product1 
 - Data_1a         500 
 - Data_2 
 - Data_2a

由于

0 个答案:

没有答案