parse,parseexact string(varchar)从dbmysql到sqlqueryc中的datetimepicker#

a11xaf1n  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(349)

我使用winform的应用程序,它通过选择日期、通过datetimepicker1接收数据,并在datagridview中显示数据,显示完所有数据后,应用程序将这些数据导出到excel。我的问题是,我不知道如何制作一个列解析器(mysql中的dmeasurement1)并将其绑定到datetime peek,然后在sql查询中完成这一切。

String userInput = Console.ReadLine();
        DateTime userDate = DateTime.Parse(userInput);

        string query = "SELECT * from EX_S[enter image description here][1]UM WHERE dmeasurement1 between '" + dateTimePicker2.Value.DateParse  + "'";
pexxcrt2

pexxcrt21#

string query = "SELECT * FROM EX_SUM WHERE STR_TO_DATE(dmeasurement1, '%d.%m.%Y') BETWEEN '" + dateTimePicker1.Value.Date.ToString("yyyy/MM/dd").Replace("/", "-") + "' AND '" + dateTimePicker2.Value.Date.ToString("yyyy/MM/dd").Replace("/", "-") + " '"; //yyyy - MM - dd

将varchar转换为datetimepicker c#

相关问题